1
0
mirror of https://github.com/deajan/obackup.git synced 2024-12-24 14:33:41 +01:00

Safer upgrade test

This commit is contained in:
deajan 2016-10-23 19:00:03 +02:00
parent 3ca39c7a0a
commit f2e0f63a33

View File

@ -1,8 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
## obackup basic tests suite 2016090403 ## obackup basic tests suite 2016102301
#TODO: add old conf file, have upgrade and check
#TODO: Must recreate files before each test set #TODO: Must recreate files before each test set
OBACKUP_DIR="$(pwd)" OBACKUP_DIR="$(pwd)"
@ -22,9 +21,10 @@ LOCAL_CONF="local.conf"
PULL_CONF="pull.conf" PULL_CONF="pull.conf"
PUSH_CONF="push.conf" PUSH_CONF="push.conf"
OLD_CONF="old.conf" OLD_CONF="old.conf"
TMP_OLD_CONF="tmp.old.conf"
OBACKUP_EXECUTABLE=obackup.sh OBACKUP_EXECUTABLE="obackup.sh"
OBACKUP_UPGRADE=upgrade-v1.x-2.1x.sh OBACKUP_UPGRADE="upgrade-v1.x-2.1x.sh"
SOURCE_DIR="${HOME}/obackup-testdata" SOURCE_DIR="${HOME}/obackup-testdata"
TARGET_DIR="${HOME}/obackup-storage" TARGET_DIR="${HOME}/obackup-storage"
@ -629,13 +629,17 @@ function test_UpgradeConfPullRun () {
# Basic return code tests. Need to go deep into file presence testing # Basic return code tests. Need to go deep into file presence testing
cd "$OBACKUP_DIR" cd "$OBACKUP_DIR"
./$OBACKUP_UPGRADE "$CONF_DIR/$OLD_CONF"
# Make a security copy of the old config file
cp "$CONF_DIR/$OLD_CONF" "$CONF_DIR/$TMP_OLD_CONF"
./$OBACKUP_UPGRADE "$CONF_DIR/$TMP_OLD_CONF"
assertEquals "Conf file upgrade" "0" $? assertEquals "Conf file upgrade" "0" $?
./$OBACKUP_EXECUTABLE "$CONF_DIR/$OLD_CONF" ./$OBACKUP_EXECUTABLE "$CONF_DIR/$TMP_OLD_CONF"
assertEquals "Upgraded conf file execution test" "0" $? assertEquals "Upgraded conf file execution test" "0" $?
# Move pre-upgraded file to original location agian rm -f "$CONF_DIR/$TMP_OLD_CONF"
mv -f "$CONF_DIR/$OLD_CONF.save" "$CONF_DIR/$OLD_CONF" rm -f "$CONF_DIR/$TMP_OLD_CONF.save"
} }
. "$TESTS_DIR/shunit2/shunit2" . "$TESTS_DIR/shunit2/shunit2"