diff --git a/dev/tests/conf/local-max-exec-time.conf b/dev/tests/conf/local-max-exec-time.conf index aa94e14..4fce2ab 100644 --- a/dev/tests/conf/local-max-exec-time.conf +++ b/dev/tests/conf/local-max-exec-time.conf @@ -23,8 +23,8 @@ BACKUP_TYPE=local ###### BACKUP STORAGE ## Storage paths of the backups (absolute paths of the local or remote system) -SQL_STORAGE="~/obackup-storage/sql" -FILE_STORAGE="~/obackup-storage/files" +SQL_STORAGE="${HOME}/obackup-storage/sql" +FILE_STORAGE="${HOME}/obackup-storage/files" ## Backup encryption using GPG and duplicity. Feature not ready yet. ENCRYPTION=no diff --git a/dev/tests/conf/local.conf b/dev/tests/conf/local.conf index 74f7f6c..3e3b833 100644 --- a/dev/tests/conf/local.conf +++ b/dev/tests/conf/local.conf @@ -23,8 +23,8 @@ BACKUP_TYPE=local ###### BACKUP STORAGE ## Storage paths of the backups (absolute paths of the local or remote system) -SQL_STORAGE="~/obackup-storage/sql" -FILE_STORAGE="~/obackup-storage/files" +SQL_STORAGE="${HOME}/obackup-storage/sql" +FILE_STORAGE="${HOME}/obackup-storage/files" ## Backup encryption using GPG and duplicity. Feature not ready yet. ENCRYPTION=no @@ -81,7 +81,7 @@ SQL_USER=root ## Enabling the following option will save all databases on local or remote given SQL instance except the ones specified in the exclude list. ## Every found database will be backed up as separate backup task. DATABASES_ALL=yes -DATABASES_ALL_EXCLUDE_LIST="test;information_schema" +DATABASES_ALL_EXCLUDE_LIST="test;information_schema;zarafa-prod" ## Alternatively, if DATABASES_ALL=no, you can specify a list of databases to backup separated by spaces. DATABASES_LIST="mysql" diff --git a/dev/tests/conf/pull.conf b/dev/tests/conf/pull.conf index 8bfeec5..1e9e5d0 100644 --- a/dev/tests/conf/pull.conf +++ b/dev/tests/conf/pull.conf @@ -23,8 +23,8 @@ BACKUP_TYPE=pull ###### BACKUP STORAGE ## Storage paths of the backups (absolute paths of the local or remote system) -SQL_STORAGE="~/obackup-storage/sql-pull" -FILE_STORAGE="~/obackup-storage/files-pull" +SQL_STORAGE="${HOME}/obackup-storage/sql-pull" +FILE_STORAGE="${HOME}/obackup-storage/files-pull" ## Backup encryption using GPG and duplicity. Feature not ready yet. ENCRYPTION=no @@ -81,7 +81,7 @@ SQL_USER=root ## Enabling the following option will save all databases on local or remote given SQL instance except the ones specified in the exclude list. ## Every found database will be backed up as separate backup task. DATABASES_ALL=yes -DATABASES_ALL_EXCLUDE_LIST="test;information_schema" +DATABASES_ALL_EXCLUDE_LIST="test;information_schema;zarafa-prod" ## Alternatively, if DATABASES_ALL=no, you can specify a list of databases to backup separated by spaces. DATABASES_LIST="mysql" diff --git a/dev/tests/conf/push.conf b/dev/tests/conf/push.conf index 0d3a21d..7ce8592 100644 --- a/dev/tests/conf/push.conf +++ b/dev/tests/conf/push.conf @@ -23,8 +23,8 @@ BACKUP_TYPE=push ###### BACKUP STORAGE ## Storage paths of the backups (absolute paths of the local or remote system) -SQL_STORAGE="~/obackup-storage/sql-push" -FILE_STORAGE="~/obackup-storage/files-push" +SQL_STORAGE="${HOME}/obackup-storage/sql-push" +FILE_STORAGE="${HOME}/obackup-storage/files-push" ## Backup encryption using GPG and duplicity. Feature not ready yet. ENCRYPTION=no @@ -81,7 +81,7 @@ SQL_USER=root ## Enabling the following option will save all databases on local or remote given SQL instance except the ones specified in the exclude list. ## Every found database will be backed up as separate backup task. DATABASES_ALL=yes -DATABASES_ALL_EXCLUDE_LIST="test;information_schema" +DATABASES_ALL_EXCLUDE_LIST="test;information_schema;zarafa-prod" ## Alternatively, if DATABASES_ALL=no, you can specify a list of databases to backup separated by spaces. DATABASES_LIST="mysql" @@ -102,9 +102,9 @@ COMPRESSION_LEVEL=3 ## You can exclude directories from the avove backup task creation, ex: avoid backing up "/home/dir2" by adding it to RECURSIVE_EXCLUDE_LIST. ## Directories backup list. List of semicolon separated directories that will be backed up. -DIRECTORY_LIST="~/obackup-testdata/testData" -RECURSIVE_DIRECTORY_LIST="~/obackup-testdata/testDataRecursive" -RECURSIVE_EXCLUDE_LIST="~/obackup-testdata/testDataRecursive/Excluded" +DIRECTORY_LIST="${HOME}/obackup-testdata/testData" +RECURSIVE_DIRECTORY_LIST="${HOME}/obackup-testdata/testDataRecursive" +RECURSIVE_EXCLUDE_LIST="${HOME}/obackup-testdata/testDataRecursive/Excluded" ## Rsync exclude / include order (the option set here will be set first, eg: include will make include then exclude patterns) RSYNC_PATTERN_FIRST=include diff --git a/dev/tests/run_local_tests.sh b/dev/tests/run_local_tests.sh index 72baac5..1404c2c 100755 --- a/dev/tests/run_local_tests.sh +++ b/dev/tests/run_local_tests.sh @@ -8,6 +8,8 @@ OBACKUP_DIR=${OBACKUP_DIR%%/dev*} DEV_DIR="$OBACKUP_DIR/dev" TESTS_DIR="$DEV_DIR/tests" +OBACKUP_EXECUTABLE=obackup.sh + SOURCE_DIR="${HOME}/obackup-testdata" TARGET_DIR="${HOME}/obackup-storage" @@ -43,13 +45,6 @@ DATABASE_EXCLUDED="information_schema.sql.xz" function oneTimeSetUp () { source "$DEV_DIR/ofunctions.sh" - if grep "^IS_STABLE=YES" "$DEV_DIR/n_obackup.sh" > /dev/null; then - IS_STABLE=yes - else - IS_STABLE=no - sed -i 's/^IS_STABLE=no/IS_STABLE=yes/' "$DEV_DIR/n_obackup.sh" - fi - mkdir -p "$SOURCE_DIR/$SIMPLE_DIR/$S_DIR_1" mkdir -p "$SOURCE_DIR/$RECURSIVE_DIR/$R_EXCLUDED_DIR" mkdir -p "$SOURCE_DIR/$RECURSIVE_DIR/$R_DIR_1" @@ -92,7 +87,7 @@ function oneTimeSetUp () { function oneTimeTearDown () { if [ "$IS_STABLE" == "no" ]; then - sed -i 's/^IS_STABLE=yes/IS_STABLE=no/' "$DEV_DIR/n_obackup.sh" + sed -i 's/^IS_STABLE=yes/IS_STABLE=no/' "$OBACKUP_DIR/$OBACKUP_EXECUTABLE" fi #rm -rf $SOURCE_DIR @@ -105,10 +100,20 @@ function test_Merge () { assertEquals "Merging code" "0" $? } +function test_SetStable () { + if grep "^IS_STABLE=YES" "$OBACKUP_DIR/$OBACKUP_EXECUTABLE" > /dev/null; then + IS_STABLE=yes + else + IS_STABLE=no + sed -i 's/^IS_STABLE=no/IS_STABLE=yes/' "$OBACKUP_DIR/$OBACKUP_EXECUTABLE" + assertEquals "Set as stable" "0" $? + fi +} + function test_FirstLocalRun () { # Basic return code tests. Need to go deep into file presence testing cd "$OBACKUP_DIR" - ./obackup.sh dir/tests/conf/local.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/local.conf assertEquals "Return code" "0" $? for file in "${FilePresence[@]}"; do @@ -140,7 +145,7 @@ function test_FirstLocalRun () { function test_SecondLocalRun () { # Only tests presence of rotated files cd "$OBACKUP_DIR" - ./obackup.sh dev/test/conf/local.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/local.conf assertEquals "Return code" "0" $? for file in "${DatabasePresence[@]}"; do @@ -154,7 +159,7 @@ function test_SecondLocalRun () { function test_FirstPullRun () { # Basic return code tests. Need to go deep into file presence testing cd "$OBACKUP_DIR" - ./obackup.sh dev/test/conf/pull.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/pull.conf assertEquals "Return code" "0" $? for file in "${FilePresence[@]}"; do @@ -186,7 +191,7 @@ function test_FirstPullRun () { function test_SecondPullRun () { # Only tests presence of rotated files cd "$OBACKUP_DIR" - ./obackup.sh dev/test/conf/pull.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/pull.conf assertEquals "Return code" "0" $? for file in "${DatabasePresence[@]}"; do @@ -201,7 +206,7 @@ function test_SecondPullRun () { function test_FirstPushRun () { # Basic return code tests. Need to go deep into file presence testing cd "$OBACKUP_DIR" - ./obackup.sh dev/test/conf/push.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/push.conf assertEquals "Return code" "0" $? for file in "${FilePresence[@]}"; do @@ -233,7 +238,7 @@ function test_FirstPushRun () { function test_SecondPushRun () { # Only tests presence of rotated files cd "$OBACKUP_DIR" - ./obackup.sh dev/test/conf/push.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/push.conf assertEquals "Return code" "0" $? for file in "${DatabasePresence[@]}"; do diff --git a/dev/tests/run_travis_tests.sh b/dev/tests/run_travis_tests.sh index e157cd1..275653a 100755 --- a/dev/tests/run_travis_tests.sh +++ b/dev/tests/run_travis_tests.sh @@ -8,6 +8,8 @@ OBACKUP_DIR=${OBACKUP_DIR%%/dev*} DEV_DIR="$OBACKUP_DIR/dev" TESTS_DIR="$DEV_DIR/tests" +OBACKUP_EXECUTABLE=obackup.sh + SOURCE_DIR="${HOME}/obackup-testdata" TARGET_DIR="${HOME}/obackup-storage" @@ -43,13 +45,6 @@ DATABASE_EXCLUDED="information_schema.sql.xz" function oneTimeSetUp () { source "$DEV_DIR/ofunctions.sh" - if grep "^IS_STABLE=YES" "$DEV_DIR/n_obackup.sh"; then - IS_STABLE=yes - else - IS_STABLE=no - sed -i 's/^IS_STABLE=no/IS_STABLE=yes/' "$DEV_DIR/n_obackup.sh" - fi - mkdir -p "$SOURCE_DIR/$SIMPLE_DIR/$S_DIR_1" mkdir -p "$SOURCE_DIR/$RECURSIVE_DIR/$R_EXCLUDED_DIR" mkdir -p "$SOURCE_DIR/$RECURSIVE_DIR/$R_DIR_1" @@ -92,24 +87,33 @@ function oneTimeSetUp () { function oneTimeTearDown () { if [ "$IS_STABLE" == "no" ]; then - sed -i 's/^IS_STABLE=yes/IS_STABLE=no/' "$DEV_DIR/n_obackup.sh" + sed -i 's/^IS_STABLE=yes/IS_STABLE=no/' "$OBACKUP_DIR/$OBACKUP_EXECUTABLE" fi #rm -rf $SOURCE_DIR #rm -rf $TARGET_DIR } - function test_Merge () { cd "$DEV_DIR" ./merge.sh - asserEquals "Merging" "0" $? + assertEquals "Merging code" "0" $? +} + +function test_SetStable () { + if grep "^IS_STABLE=YES" "$OBACKUP_DIR/$OBACKUP_EXECUTABLE" > /dev/null; then + IS_STABLE=yes + else + IS_STABLE=no + sed -i 's/^IS_STABLE=no/IS_STABLE=yes/' "$OBACKUP_DIR/$OBACKUP_EXECUTABLE" + assertEquals "Set as stable" "0" $? + fi } function test_FirstLocalRun () { # Basic return code tests. Need to go deep into file presence testing cd "$OBACKUP_DIR" - ./obackup.sh dev/tests/conf/local.conf + ./$OBACKUP_EXECUTABLE dev/tests/conf/local.conf assertEquals "Return code" "0" $? for file in "${FilePresence[@]}"; do @@ -141,7 +145,7 @@ function test_FirstLocalRun () { function test_SecondLocalRun () { # Only tests presence of rotated files cd "$OBACKUP_DIR" - ./obackup.sh dev/tests/conf/local.conf > /dev/null + ./$OBACKUP_EXECUTABLE dev/tests/conf/local.conf assertEquals "Return code" "0" $? for file in "${DatabasePresence[@]}"; do