Improved unit tests with no ssh test

This commit is contained in:
deajan 2016-11-19 14:21:42 +01:00
parent 82eaa8fa52
commit 4a8a7e7a49
1 changed files with 26 additions and 2 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# osync test suite 2016111901 # osync test suite 2016111902
# 4 tests: # 4 tests:
# quicklocal # quicklocal
@ -127,6 +127,17 @@ function SetupSSH {
fi fi
} }
function RemoveSSH {
local pubkey
if [ -f "${HOME}/.ssh/id_rsa_local" ]; then
pubkey=$(cat "${HOME}/.ssh/id_rsa_local.pub")
sed -i.bak "#$pubkey#d" "${HOME}/.ssh/authorized_keys"
rm -f "${HOME}/.ssh/{id_rsa_local.pub,id_rsa_local}"
fi
}
function DownloadLargeFileSet() { function DownloadLargeFileSet() {
local destinationPath="${1}" local destinationPath="${1}"
@ -192,6 +203,8 @@ function oneTimeTearDown () {
# Set osync version stable flag back to origin # Set osync version stable flag back to origin
SetConfFileValue "$OSYNC_DIR/$OSYNC_EXECUTABLE" "IS_STABLE" "$OSYNC_IS_STABLE" SetConfFileValue "$OSYNC_DIR/$OSYNC_EXECUTABLE" "IS_STABLE" "$OSYNC_IS_STABLE"
RemoveSSH
#TODO: uncomment this when dev is done #TODO: uncomment this when dev is done
rm -rf "$OSYNC_TESTS_DIR" rm -rf "$OSYNC_TESTS_DIR"
@ -546,7 +559,7 @@ function test_FileAttributePropagation () {
assertEquals "Set ACL on target" "0" $? assertEquals "Set ACL on target" "0" $?
# Second run # Second run
REMOTE_HOST_PING=no ./$OSYNC_EXECUTABLE $i PRESERVE_ACL=yes PRESERVE_XATTR=yes REMOTE_HOST_PING=no ./$OSYNC_EXECUTABLE $i
assertEquals "First deletion run with parameters [$i]." "0" $? assertEquals "First deletion run with parameters [$i]." "0" $?
getfacl "$TARGET_DIR/$FileA" | grep "other::r-x" > /dev/null getfacl "$TARGET_DIR/$FileA" | grep "other::r-x" > /dev/null
@ -949,4 +962,15 @@ function test_DaemonMode () {
done done
} }
function test_NoRemoteAccessTest {
RemoveSSH
cd "$OSYNC_DIR"
PrepareLocalDirs
REMOTE_HOST_PING=no ./$OSYNC_EXECUTABLE ${osyncParameters[$__confLocal]}
assertEquals "Basic local test without remote access." "0" $?
}
. "$TESTS_DIR/shunit2/shunit2" . "$TESTS_DIR/shunit2/shunit2"