|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
# osync test suite 2019070501
|
|
|
|
|
# osync test suite 2019071901
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Allows the following environment variables
|
|
|
|
@ -90,9 +90,13 @@ OSYNC_MIN_VERSION=x
|
|
|
|
|
OSYNC_IS_STABLE=maybe
|
|
|
|
|
|
|
|
|
|
function SetupSSH {
|
|
|
|
|
echo -e 'y\n'| ssh-keygen -t rsa -b 2048 -N "" -f "${HOME}/.ssh/id_rsa_local"
|
|
|
|
|
if ! grep "$(cat ${HOME}/.ssh/id_rsa_local.pub)" "${HOME}/.ssh/authorized_keys"; then
|
|
|
|
|
echo "from=\"*\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command=\"$FAKEROOT/usr/local/bin/ssh_filter.sh SomeAlphaNumericToken9\" $(cat ${HOME}/.ssh/id_rsa_local.pub)" >> "${HOME}/.ssh/authorized_keys"
|
|
|
|
|
echo -e 'y\n'| ssh-keygen -t rsa -b 2048 -N "" -f "${HOME}/.ssh/id_rsa_local_osync_tests"
|
|
|
|
|
|
|
|
|
|
SSH_AUTH_LINE="from=\"*\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command=\"$FAKEROOT/usr/local/bin/ssh_filter.sh SomeAlphaNumericToken9\" $(cat ${HOME}/.ssh/id_rsa_local_osync_tests.pub)"
|
|
|
|
|
|
|
|
|
|
if ! grep "$(cat ${HOME}/.ssh/id_rsa_local_osync_tests.pub)" "${HOME}/.ssh/authorized_keys"; then
|
|
|
|
|
echo "$SSH_AUTH_LINE" >> "${HOME}/.ssh/authorized_keys"
|
|
|
|
|
#echo "from=\"*\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command=\"$FAKEROOT/usr/local/bin/ssh_filter.sh SomeAlphaNumericToken9\" $(cat ${HOME}/.ssh/id_rsa_local_osync_tests.pub)" >> "${HOME}/.ssh/authorized_keys"
|
|
|
|
|
fi
|
|
|
|
|
chmod 600 "${HOME}/.ssh/authorized_keys"
|
|
|
|
|
|
|
|
|
@ -106,13 +110,10 @@ function SetupSSH {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function RemoveSSH {
|
|
|
|
|
local pubkey
|
|
|
|
|
|
|
|
|
|
if [ -f "${HOME}/.ssh/id_rsa_local" ]; then
|
|
|
|
|
|
|
|
|
|
pubkey=$(cat "${HOME}/.ssh/id_rsa_local.pub")
|
|
|
|
|
sed -i.bak "s|.*$pubkey.*||g" "${HOME}/.ssh/authorized_keys"
|
|
|
|
|
rm -f "${HOME}/.ssh/{id_rsa_local.pub,id_rsa_local}"
|
|
|
|
|
if [ -f "${HOME}/.ssh/id_rsa_local_osync_tests" ]; then
|
|
|
|
|
echo "Restoring SSH authorized_keys file"
|
|
|
|
|
sed -i.bak "s|.*$(cat "${HOME}/.ssh/id_rsa_local_osync_tests.pub")||g" "${HOME}/.ssh/authorized_keys"
|
|
|
|
|
rm -f "${HOME}/.ssh/{id_rsa_local_osync_tests.pub,id_rsa_local_osync_tests}"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -305,7 +306,7 @@ function setUp () {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# This test has to be done everytime in order for osync executable to be fresh
|
|
|
|
|
function test_Merge () {
|
|
|
|
|
function nope_test_Merge () {
|
|
|
|
|
cd "$DEV_DIR"
|
|
|
|
|
./merge.sh osync
|
|
|
|
|
assertEquals "Merging code" "0" $?
|
|
|
|
@ -334,7 +335,7 @@ function test_Merge () {
|
|
|
|
|
assertEquals "Install failed" "0" $?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_LargeFileSet () {
|
|
|
|
|
function nope_test_LargeFileSet () {
|
|
|
|
|
for i in "${osyncParameters[@]}"; do
|
|
|
|
|
cd "$OSYNC_DIR"
|
|
|
|
|
|
|
|
|
@ -352,15 +353,16 @@ function test_LargeFileSet () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_controlMaster () {
|
|
|
|
|
function nope_test_controlMaster () {
|
|
|
|
|
cd "$OSYNC_DIR"
|
|
|
|
|
|
|
|
|
|
PrepareLocalDirs
|
|
|
|
|
REMOTE_HOST_PING=$REMOTE_PING $OSYNC_EXECUTABLE $osyncParameters[$__quickRemote] --ssh-controlmaster
|
|
|
|
|
echo "Running with parameters ${osyncParameters[$__quickRemote]} --ssh-controlmaster"
|
|
|
|
|
REMOTE_HOST_PING=$REMOTE_PING $OSYNC_EXECUTABLE ${osyncParameters[$__quickRemote]} --ssh-controlmaster
|
|
|
|
|
assertEquals "Running quick remote test with controlmaster enabled." "0" $?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_Exclusions () {
|
|
|
|
|
function nope_test_Exclusions () {
|
|
|
|
|
# Will sync except php files
|
|
|
|
|
# RSYNC_EXCLUDE_PATTERN="*.php" is set at runtime for quicksync and in config files for other runs
|
|
|
|
|
|
|
|
|
@ -388,7 +390,7 @@ function test_Exclusions () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_Deletetion () {
|
|
|
|
|
function nope_test_Deletetion () {
|
|
|
|
|
local iFile1="$INITIATOR_DIR/i fic"
|
|
|
|
|
local iFile2="$INITIATOR_DIR/i foc"
|
|
|
|
|
local tFile1="$TARGET_DIR/t fic"
|
|
|
|
@ -432,7 +434,7 @@ function test_Deletetion () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_deletion_failure () {
|
|
|
|
|
function nope_test_deletion_failure () {
|
|
|
|
|
if [ "$LOCAL_OS" == "WinNT10" ] || [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "Cygwin" ]; then
|
|
|
|
|
echo "Skipping deletion failure test as Win10 does not have chattr support."
|
|
|
|
|
return 0
|
|
|
|
@ -499,7 +501,7 @@ function test_deletion_failure () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_skip_deletion () {
|
|
|
|
|
function nope_test_skip_deletion () {
|
|
|
|
|
local modes
|
|
|
|
|
|
|
|
|
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
|
|
|
@ -575,7 +577,7 @@ function test_skip_deletion () {
|
|
|
|
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SKIP_DELETION" ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_handle_symlinks () {
|
|
|
|
|
function nope_test_handle_symlinks () {
|
|
|
|
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
|
|
|
|
echo "Skipping symlink tests as osync v1.1x didn't handle this."
|
|
|
|
|
return 0
|
|
|
|
@ -756,7 +758,7 @@ function test_handle_symlinks () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_softdeletion_cleanup () {
|
|
|
|
|
function nope_test_softdeletion_cleanup () {
|
|
|
|
|
#declare -A files
|
|
|
|
|
|
|
|
|
|
files=()
|
|
|
|
@ -833,7 +835,7 @@ function test_softdeletion_cleanup () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_FileAttributePropagation () {
|
|
|
|
|
function nope_test_FileAttributePropagation () {
|
|
|
|
|
|
|
|
|
|
if [ "$TRAVIS_RUN" == true ]; then
|
|
|
|
|
echo "Skipping FileAttributePropagation tests as travis does not support getfacl / setfacl."
|
|
|
|
@ -921,7 +923,7 @@ function test_FileAttributePropagation () {
|
|
|
|
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "PRESERVE_XATTR" false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_ConflictBackups () {
|
|
|
|
|
function nope_test_ConflictBackups () {
|
|
|
|
|
for i in "${osyncParameters[@]}"; do
|
|
|
|
|
cd "$OSYNC_DIR"
|
|
|
|
|
PrepareLocalDirs
|
|
|
|
@ -957,7 +959,7 @@ function test_ConflictBackups () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_MultipleConflictBackups () {
|
|
|
|
|
function nope_test_MultipleConflictBackups () {
|
|
|
|
|
|
|
|
|
|
local additionalParameters
|
|
|
|
|
|
|
|
|
@ -1019,7 +1021,7 @@ function test_MultipleConflictBackups () {
|
|
|
|
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_Locking () {
|
|
|
|
|
function nope_test_Locking () {
|
|
|
|
|
# local not running = resume
|
|
|
|
|
# remote same instance_id = resume
|
|
|
|
|
# remote different instance_id = stop
|
|
|
|
@ -1126,7 +1128,7 @@ function test_Locking () {
|
|
|
|
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_ConflictDetetion () {
|
|
|
|
|
function nope_test_ConflictDetetion () {
|
|
|
|
|
# Tests compatible with v1.4+
|
|
|
|
|
|
|
|
|
|
if [ $OSYNC_MIN_VERSION -lt 4 ]; then
|
|
|
|
@ -1177,7 +1179,7 @@ function test_ConflictDetetion () {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_WaitForTaskCompletion () {
|
|
|
|
|
function nope_test_WaitForTaskCompletion () {
|
|
|
|
|
local pids
|
|
|
|
|
|
|
|
|
|
# Tests compatible with v1.1 syntax
|
|
|
|
@ -1271,7 +1273,7 @@ function test_WaitForTaskCompletion () {
|
|
|
|
|
assertEquals "WaitForTaskCompletion test 5" "2" $?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_ParallelExec () {
|
|
|
|
|
function nope_test_ParallelExec () {
|
|
|
|
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
|
|
|
|
echo "Skipping ParallelExec test because osync v1.1 ofunctions don't have this function."
|
|
|
|
|
return 0
|
|
|
|
@ -1332,7 +1334,7 @@ function test_ParallelExec () {
|
|
|
|
|
assertNotEquals "ParallelExec full test 3" "0" $?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_timedExecution () {
|
|
|
|
|
function nope_test_timedExecution () {
|
|
|
|
|
local arguments
|
|
|
|
|
|
|
|
|
|
# Clever usage of indexes and exit codes
|
|
|
|
@ -1378,7 +1380,7 @@ function test_timedExecution () {
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_UpgradeConfRun () {
|
|
|
|
|
function nope_test_UpgradeConfRun () {
|
|
|
|
|
if [ "$OSYNC_MIN_VERSION" == "1" ]; then
|
|
|
|
|
echo "Skipping Upgrade script test because no further dev will happen on this for v1.1"
|
|
|
|
|
return 0
|
|
|
|
@ -1404,7 +1406,7 @@ function test_UpgradeConfRun () {
|
|
|
|
|
rm -f "$CONF_DIR/$TMP_OLD_CONF.save"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_DaemonMode () {
|
|
|
|
|
function nope_test_DaemonMode () {
|
|
|
|
|
if [ "$LOCAL_OS" == "WinNT10" ] || [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "Cygwin" ]; then
|
|
|
|
|
echo "Skipping daemon mode test as [$LOCAL_OS] does not have inotifywait support."
|
|
|
|
|
return 0
|
|
|
|
@ -1460,7 +1462,7 @@ function test_DaemonMode () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function test_NoRemoteAccessTest () {
|
|
|
|
|
function nope_test_NoRemoteAccessTest () {
|
|
|
|
|
RemoveSSH
|
|
|
|
|
|
|
|
|
|
cd "$OSYNC_DIR"
|
|
|
|
|