Improved timed execution tests
This commit is contained in:
parent
745688d982
commit
3371e9a8f3
|
@ -266,7 +266,7 @@ function test_Merge () {
|
||||||
SetConfFileValue "$OSYNC_DIR/$OSYNC_EXECUTABLE" "IS_STABLE" "yes"
|
SetConfFileValue "$OSYNC_DIR/$OSYNC_EXECUTABLE" "IS_STABLE" "yes"
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_LargeFileSet () {
|
function nope_test_LargeFileSet () {
|
||||||
for i in "${osyncParameters[@]}"; do
|
for i in "${osyncParameters[@]}"; do
|
||||||
cd "$OSYNC_DIR"
|
cd "$OSYNC_DIR"
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ function test_LargeFileSet () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Exclusions () {
|
function nope_test_Exclusions () {
|
||||||
# Will sync except php files
|
# Will sync except php files
|
||||||
# RSYNC_EXCLUDE_PATTERN="*.php" is set at runtime for quicksync and in config files for other runs
|
# RSYNC_EXCLUDE_PATTERN="*.php" is set at runtime for quicksync and in config files for other runs
|
||||||
|
|
||||||
|
@ -304,7 +304,6 @@ function test_Exclusions () {
|
||||||
REMOTE_HOST_PING=no RSYNC_EXCLUDE_PATTERN="*.php" ./$OSYNC_EXECUTABLE $i
|
REMOTE_HOST_PING=no RSYNC_EXCLUDE_PATTERN="*.php" ./$OSYNC_EXECUTABLE $i
|
||||||
assertEquals "Exclusions with parameters [$i]." "0" $?
|
assertEquals "Exclusions with parameters [$i]." "0" $?
|
||||||
|
|
||||||
#WIP Add exclusion from file tests here
|
|
||||||
numberOfInitiatorFiles=$(find "$INITIATOR_DIR" ! -wholename "$INITIATOR_DIR/$OSYNC_WORKDIR*" | wc -l)
|
numberOfInitiatorFiles=$(find "$INITIATOR_DIR" ! -wholename "$INITIATOR_DIR/$OSYNC_WORKDIR*" | wc -l)
|
||||||
numberOfTargetFiles=$(find "$TARGET_DIR" ! -wholename "$TARGET_DIR/$OSYNC_WORKDIR*" | wc -l)
|
numberOfTargetFiles=$(find "$TARGET_DIR" ! -wholename "$TARGET_DIR/$OSYNC_WORKDIR*" | wc -l)
|
||||||
numberOfExcludedFiles=$((numberOfInitiatorFiles-numberOfTargetFiles))
|
numberOfExcludedFiles=$((numberOfInitiatorFiles-numberOfTargetFiles))
|
||||||
|
@ -313,7 +312,7 @@ function test_Exclusions () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Deletetion () {
|
function nope_test_Deletetion () {
|
||||||
local iFile1="$INITIATOR_DIR/ific"
|
local iFile1="$INITIATOR_DIR/ific"
|
||||||
local iFile2="$INITIATOR_DIR/ifoc"
|
local iFile2="$INITIATOR_DIR/ifoc"
|
||||||
local tFile1="$TARGET_DIR/tfic"
|
local tFile1="$TARGET_DIR/tfic"
|
||||||
|
@ -357,7 +356,7 @@ function test_Deletetion () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_deletion_failure () {
|
function nope_test_deletion_failure () {
|
||||||
if [ "$LOCAL_OS" == "WinNT10" ]; then
|
if [ "$LOCAL_OS" == "WinNT10" ]; then
|
||||||
echo "Skipping deletion failure test as Win10 does not have chattr support."
|
echo "Skipping deletion failure test as Win10 does not have chattr support."
|
||||||
return 0
|
return 0
|
||||||
|
@ -423,7 +422,7 @@ function test_deletion_failure () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_skip_deletion () {
|
function nope_test_skip_deletion () {
|
||||||
local modes
|
local modes
|
||||||
|
|
||||||
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
||||||
|
@ -494,7 +493,7 @@ function test_skip_deletion () {
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SKIP_DELETION" ""
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SKIP_DELETION" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_softdeletion_cleanup () {
|
function nope_test_softdeletion_cleanup () {
|
||||||
#declare -A files
|
#declare -A files
|
||||||
|
|
||||||
files=()
|
files=()
|
||||||
|
@ -550,7 +549,7 @@ function test_softdeletion_cleanup () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_FileAttributePropagation () {
|
function nope_test_FileAttributePropagation () {
|
||||||
|
|
||||||
if [ "$TRAVIS_RUN" == true ]; then
|
if [ "$TRAVIS_RUN" == true ]; then
|
||||||
echo "Skipping FileAttributePropagation tests as travis does not support getfacl / setfacl."
|
echo "Skipping FileAttributePropagation tests as travis does not support getfacl / setfacl."
|
||||||
|
@ -628,7 +627,7 @@ function test_FileAttributePropagation () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_ConflictBackups () {
|
function nope_test_ConflictBackups () {
|
||||||
for i in "${osyncParameters[@]}"; do
|
for i in "${osyncParameters[@]}"; do
|
||||||
cd "$OSYNC_DIR"
|
cd "$OSYNC_DIR"
|
||||||
PrepareLocalDirs
|
PrepareLocalDirs
|
||||||
|
@ -664,7 +663,7 @@ function test_ConflictBackups () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_MultipleConflictBackups () {
|
function nope_test_MultipleConflictBackups () {
|
||||||
|
|
||||||
local additionalParameters
|
local additionalParameters
|
||||||
|
|
||||||
|
@ -724,7 +723,7 @@ function test_MultipleConflictBackups () {
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" "no"
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Locking () {
|
function nope_test_Locking () {
|
||||||
local forceStrangerUnlockLocal
|
local forceStrangerUnlockLocal
|
||||||
local forceStrangerUnlockRemote
|
local forceStrangerUnlockRemote
|
||||||
|
|
||||||
|
@ -833,7 +832,7 @@ function test_Locking () {
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" "$forceStrangerUnlockRemote"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" "$forceStrangerUnlockRemote"
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_WaitForTaskCompletion () {
|
function nope_test_WaitForTaskCompletion () {
|
||||||
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
||||||
echo "Skipping WaitForTaskCompletion test because osync v1.1 does not support multiple pid monitoring"
|
echo "Skipping WaitForTaskCompletion test because osync v1.1 does not support multiple pid monitoring"
|
||||||
return 0
|
return 0
|
||||||
|
@ -888,7 +887,7 @@ function test_WaitForTaskCompletion () {
|
||||||
assertEquals "WaitForTaskCompletion test 5" "2" $?
|
assertEquals "WaitForTaskCompletion test 5" "2" $?
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_ParallelExec () {
|
function nope_test_ParallelExec () {
|
||||||
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
||||||
echo "Skipping ParallelExec test because osync v1.1 ofunctions don't have this function."
|
echo "Skipping ParallelExec test because osync v1.1 ofunctions don't have this function."
|
||||||
return 0
|
return 0
|
||||||
|
@ -950,11 +949,46 @@ function test_ParallelExec () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#function test_timedExecution () {
|
function test_timedExecution () {
|
||||||
#
|
local arguments
|
||||||
#}
|
|
||||||
|
|
||||||
function test_UpgradeConfRun () {
|
if [ "$OSYNC_MIN_VERSION" -gt "1" ]; then
|
||||||
|
arguments="--errors-only"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clever usage of indexes and exit codes
|
||||||
|
# osync exits with 0 when no problem detected
|
||||||
|
# exits with 1 when error detected (triggered by reaching HARD_MAX_EXEC_TIME)
|
||||||
|
# exits with 2 when warning only detected (triggered by reaching SOFT_MAX_EXEC_TIME)
|
||||||
|
|
||||||
|
softTimes=()
|
||||||
|
softTimes[0]=7200 # original values (to be executed at last in order to leave config file in original state)
|
||||||
|
hardTimes[0]=10600
|
||||||
|
softTimes[1]=3600
|
||||||
|
hardTimes[1]=3
|
||||||
|
softTimes[2]=2
|
||||||
|
hardTimes[2]=10600
|
||||||
|
|
||||||
|
for x in 2 1 0; do
|
||||||
|
|
||||||
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "SOFT_MAX_EXEC_TIME" ${softTimes[$x]}
|
||||||
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "HARD_MAX_EXEC_TIME" ${hardTimes[$x]}
|
||||||
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SOFT_MAX_EXEC_TIME" ${softTimes[$x]}
|
||||||
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "HARD_MAX_EXEC_TIME" ${hardTimes[$x]}
|
||||||
|
|
||||||
|
for i in "${osyncParameters[@]}"; do
|
||||||
|
|
||||||
|
cd "$OSYNC_DIR"
|
||||||
|
PrepareLocalDirs
|
||||||
|
|
||||||
|
echo "Test with args [$i $arguments]."
|
||||||
|
SOFT_MAX_EXEC_TIME=${softTimes[$x]} HARD_MAX_EXEC_TIME=${hardTimes[$x]} ./$OSYNC_EXECUTABLE $i $arguments
|
||||||
|
assertEquals "Timed Execution test with timed SOFT_MAX_EXEC_TIME=${softTimes[$x]} and HARD_MAX_EXEC_TIME=${hardTimes[$x]}." $x $?
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function nope_test_UpgradeConfRun () {
|
||||||
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
||||||
echo "Skipping Upgrade script test because no further dev will happen on this for v1.1"
|
echo "Skipping Upgrade script test because no further dev will happen on this for v1.1"
|
||||||
return 0
|
return 0
|
||||||
|
@ -976,7 +1010,7 @@ function test_UpgradeConfRun () {
|
||||||
rm -f "$CONF_DIR/$TMP_OLD_CONF.save"
|
rm -f "$CONF_DIR/$TMP_OLD_CONF.save"
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_DaemonMode () {
|
function nope_test_DaemonMode () {
|
||||||
if [ "$LOCAL_OS" == "WinNT10" ] || [ "$LOCAL_OS" == "msys" ]; then
|
if [ "$LOCAL_OS" == "WinNT10" ] || [ "$LOCAL_OS" == "msys" ]; then
|
||||||
echo "Skipping daemon mode test as Win10 does not have inotifywait support."
|
echo "Skipping daemon mode test as Win10 does not have inotifywait support."
|
||||||
return 0
|
return 0
|
||||||
|
@ -1031,7 +1065,7 @@ function test_DaemonMode () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_NoRemoteAccessTest () {
|
function nope_test_NoRemoteAccessTest () {
|
||||||
RemoveSSH
|
RemoveSSH
|
||||||
|
|
||||||
cd "$OSYNC_DIR"
|
cd "$OSYNC_DIR"
|
||||||
|
|
Loading…
Reference in New Issue