test 5 en place qui change de branche

This commit is contained in:
eleonore12345 2024-07-15 15:44:03 +02:00
parent 49f361670d
commit 0c87c46c18

View File

@ -6,9 +6,11 @@ echo "<execution of test_git_update.sh>"
REPO_NAME=performance_testing
REMOTE=ssh://git@git.jean-cloud.net:22529/eleonore/performance_testing.git
WITH_SUBMODULE="true"
FILENAMES=("sample0" "sample1") #we do not check for all files
FILENAMES=("sample0" "sample1 sample3") #we do not check for all files
FILENAMES_TAG=("sample0")
FILENAMES_BRANCH=("sample0" "sample1") #we do not check for all files, especially not those specific to the branch.
FILENAMES_BRANCH=("sample0 sample1 sample2") #we do not check for all files, especially not those specific to the branch.
FILE_ON_BRANCH_ONLY=sample2
FILE_ON_MAIN_ONLY=sample3
TAG_NAME=start
BRANCH_NAME=secondary
TEMP_CLONE_DIR="temp_local_clone"
@ -149,6 +151,23 @@ modification_check(){
fi
}
changing_branch_check(){
if [ -f $FILE_ON_BRANCH_ONLY ]; then
echo "The files of the branch $BRANCH_NAME are present."
branch_changing_result=0
else
echo "The files of the branch $BRANCH_NAME are absent."
branch_changing_result=1
fi
if [ -f $FILE_ON_MAIN_ONLY ]; then
echo "The files of the branch main are present."
branch_changing_result=1
else
echo "The files of the branch main are absent."
branch_changing_result=0
fi
}
test0 (){
#CASE 0: git cloned in an empty directory
section TEST0
@ -281,6 +300,27 @@ test4(){
fi
}
test5(){
#CASE 5: git updated, changing to another branch, deleting and adding files in the process
section TEST5
#if it exists, delete the directory
if [ -d $REPO_NAME ]; then
run rm -rf $REPO_NAME
fi
#clone the repo in its last state
run git clone --recurse-submodules --shallow-submodules --depth 1 --config core.sshCommand="ssh" $REMOTE &> /dev/null
#call git update with another branch
cd $REPO_NAME
../git_update.sh -r $BRANCH_NAME $REMOTE
#checks
changing_branch_check
case5=$branch_changing_result
if [ "$case5" = "0" ]; then
echo "case 5, branch-changing update: OK"
else
echo "case 5, branch-changing update: FAIL"
fi
}
#not ff
#ref changed