1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00

Improved travis CI tests

This commit is contained in:
deajan 2016-08-30 18:12:59 +02:00
parent a9077af7bb
commit 133e1ebe0e
6 changed files with 49 additions and 40 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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