This commit is contained in:
eleonore12345 2024-07-12 10:10:04 +02:00
parent 6833b80658
commit 0508ad3a11

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")
FILENAMES=("sample0" "sample1") #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.
TAG_NAME=start
BRANCH_NAME=secondary
if [ "$WITH_SUBMODULE" = "true" ]; then
bash creation_repo.sh -s &> /dev/null
@ -27,7 +29,13 @@ OPTIONS
-a excutes all the tests.
-n number executes test number
-h prints the help.
DESCRIPTION"
DESCRIPTION
Tests on the initial cloning
TEST0: git cloned in an empty directory
TEST1: git cloned in an empty directory with tag
TEST2: git cloned in an empty directory with branch
"
}
cloning_check(){
@ -78,8 +86,21 @@ tag_check(){
cd ..
}
branch_check(){
run cd $REPO_NAME
run git branch > res
if [ $(grep $BRANCH_NAME res | wc -l) = 1 ];then
echo "The branch instruction has been respected"
branch_result=0
else
branch_result=1
echo "The branch instruction has not been respected"
fi
cd ..
}
test0 (){
#CASE 0: git cloned in an empty directory without tag
#CASE 0: git cloned in an empty directory
section TEST0
#if it exists, delete the directory
if [ -d $REPO_NAME ]; then
@ -91,9 +112,9 @@ test0 (){
history_check
case0=$(($history_result+$cloning_result))
if [ "$case0" = "0" ]; then
echo "case 0, in a empty directory without history, without tag : OK"
echo "case 0, in a empty directory without history: OK"
else
echo "case 0, in a empty directory without history, without tag : FAIL"
echo "case 0, in a empty directory without history: FAIL"
fi
}
@ -112,14 +133,31 @@ test1(){
case1=$(($cloning_result+$history_result+$tag_result))
if [ $case1 = 0 ]; then
echo "case 1, in a empty directory without history, with tag : OK"
echo "case 1, in a empty directory without history, with tag: OK"
else
echo "case 1, in a empty directory without history, with tag : FAIL"
echo "case 1, in a empty directory without history, with tag: FAIL"
fi
}
test2(){
#CASE 2: git cloned in an empty directory with branch
section TEST2
#if it exists, delete the directory
if [ -d $REPO_NAME ]; then
run rm -rf $REPO_NAME
fi
run ./git_update.sh -d $REPO_NAME -r $BRANCH_NAME $REMOTE
#checks
cloning_check $FILENAMES_BRANCH #we do not check for all files, especially not those specific to the branch.
history_check
branch_check
case1=$(($cloning_result+$history_result+$branch_result))
if [ $case1 = 0 ]; then
echo "case 1, in a empty directory without history, with branch: OK"
else
echo "case 1, in a empty directory without history, with branch: FAIL"
fi
}