mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-08 11:52:32 +01:00
tests: implement runaction in other tests
This commit is contained in:
parent
6564cff1ce
commit
bf612c9390
@ -32,7 +32,7 @@ teardown_mysql() {
|
||||
@test "sqldump: exports all databases, with compression" {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql compress yes
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz" ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql.gz" ]
|
||||
[ "$(zgrep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz)" -eq 9 ]
|
||||
@ -42,7 +42,7 @@ teardown_mysql() {
|
||||
@test "sqldump: exports all databases, without compression" {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql compress no
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql" ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql" ]
|
||||
[ "$(grep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql)" -eq 9 ]
|
||||
@ -51,7 +51,7 @@ teardown_mysql() {
|
||||
|
||||
@test "sqldump: exports specific database" {
|
||||
setconfig backup.d/test.mysql databases bntest_v11vJj
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ ! -f ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql.gz" ]
|
||||
[ "$(zgrep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql.gz)" -eq 47 ]
|
||||
@ -60,7 +60,7 @@ teardown_mysql() {
|
||||
@test "ignores: exports all databases while excluding two tables entirely" {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql ignores "bntest_v11vJj.cache_data bntest_v11vJj.cache_entity"
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz" ]
|
||||
[ "$(zgrep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz)" -eq 9 ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql.gz" ]
|
||||
@ -73,7 +73,7 @@ teardown_mysql() {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql compress yes
|
||||
setconfig backup.d/test.mysql nodata bntest_v11vJj.cache_data
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz" ]
|
||||
[ "$(zgrep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz)" -eq 9 ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql.gz" ]
|
||||
@ -85,7 +85,7 @@ teardown_mysql() {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql compress no
|
||||
setconfig backup.d/test.mysql nodata bntest_v11vJj.cache_data
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql" ]
|
||||
[ "$(grep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql)" -eq 9 ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql" ]
|
||||
@ -97,7 +97,7 @@ teardown_mysql() {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql compress yes
|
||||
setconfig backup.d/test.mysql nodata "bntest_v11vJj.cache_data bntest_v11vJj.cache_entity"
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz" ]
|
||||
[ "$(zgrep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql.gz)" -eq 9 ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql.gz" ]
|
||||
@ -110,7 +110,7 @@ teardown_mysql() {
|
||||
setconfig backup.d/test.mysql databases all
|
||||
setconfig backup.d/test.mysql compress no
|
||||
setconfig backup.d/test.mysql nodata "bntest_v11vJj.cache_data bntest_v11vJj.cache_entity"
|
||||
runaction test.mysql
|
||||
runaction
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql" ]
|
||||
[ "$(grep -c 'INSERT INTO' ${BN_BACKUPDIR}/mysql/sqldump/bntest_p8Cz8k.sql)" -eq 9 ]
|
||||
[ -s "${BN_BACKUPDIR}/mysql/sqldump/bntest_v11vJj.sql" ]
|
||||
|
@ -36,7 +36,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases all
|
||||
setconfig backup.d/test.pgsql compress yes
|
||||
setconfig backup.d/test.pgsql format plain
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest0-all.sql.gz"
|
||||
}
|
||||
@ -45,7 +45,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases all
|
||||
setconfig backup.d/test.pgsql compress no
|
||||
setconfig backup.d/test.pgsql format plain
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest0-all.sql" ]
|
||||
}
|
||||
@ -54,7 +54,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases bntest_v11vJj
|
||||
setconfig backup.d/test.pgsql compress yes
|
||||
setconfig backup.d/test.pgsql format plain
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_v11vJj.sql.gz"
|
||||
[ "$(zgrep -c -e '^COPY' ${BN_BACKUPDIR}/postgres/bntest_v11vJj.sql.gz)" -eq 68 ]
|
||||
@ -65,7 +65,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases bntest_v11vJj
|
||||
setconfig backup.d/test.pgsql compress no
|
||||
setconfig backup.d/test.pgsql format plain
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_v11vJj.sql" ]
|
||||
[ "$(grep -c -e '^COPY' ${BN_BACKUPDIR}/postgres/bntest_v11vJj.sql)" -eq 68 ]
|
||||
@ -76,7 +76,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases all
|
||||
setconfig backup.d/test.pgsql compress yes
|
||||
setconfig backup.d/test.pgsql format tar
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_p8Cz8k.pg_dump.gz"
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump.gz"
|
||||
@ -87,7 +87,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases all
|
||||
setconfig backup.d/test.pgsql compress no
|
||||
setconfig backup.d/test.pgsql format tar
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_p8Cz8k.pg_dump" ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump" ]
|
||||
@ -100,7 +100,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases bntest_v11vJj
|
||||
setconfig backup.d/test.pgsql compress yes
|
||||
setconfig backup.d/test.pgsql format tar
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump.gz"
|
||||
[ ! -e "${BN_BACKUPDIR}/postgres/bntest_p8Cz8k.pg_dump.gz" ]
|
||||
@ -111,7 +111,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases bntest_v11vJj
|
||||
setconfig backup.d/test.pgsql compress no
|
||||
setconfig backup.d/test.pgsql format tar
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump" ]
|
||||
file ${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump | grep -q "POSIX tar archive"
|
||||
@ -123,7 +123,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases all
|
||||
setconfig backup.d/test.pgsql compress yes
|
||||
setconfig backup.d/test.pgsql format custom
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_p8Cz8k.pg_dump.gz"
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump.gz"
|
||||
@ -134,7 +134,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases all
|
||||
setconfig backup.d/test.pgsql compress no
|
||||
setconfig backup.d/test.pgsql format custom
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_p8Cz8k.pg_dump" ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump" ]
|
||||
@ -147,7 +147,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases bntest_v11vJj
|
||||
setconfig backup.d/test.pgsql compress yes
|
||||
setconfig backup.d/test.pgsql format custom
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
gzip -tq "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump.gz"
|
||||
[ ! -e "${BN_BACKUPDIR}/postgres/bntest_p8Cz8k.pg_dump.gz" ]
|
||||
@ -158,7 +158,7 @@ teardown_pgsql() {
|
||||
setconfig backup.d/test.pgsql databases bntest_v11vJj
|
||||
setconfig backup.d/test.pgsql compress no
|
||||
setconfig backup.d/test.pgsql format custom
|
||||
runaction test.pgsql
|
||||
runaction
|
||||
[ "$status" -eq 0 ]
|
||||
[ -s "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump" ]
|
||||
file "${BN_BACKUPDIR}/postgres/bntest_v11vJj.pg_dump" | grep -q "PostgreSQL custom database dump"
|
||||
|
@ -25,8 +25,7 @@ teardown_tar() {
|
||||
}
|
||||
|
||||
@test "no compression" {
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tar)
|
||||
echo $archive
|
||||
@ -36,8 +35,7 @@ teardown_tar() {
|
||||
|
||||
@test "compress compression" {
|
||||
setconfig backup.d/test.tar compress compress
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tar.compress)
|
||||
[ -s "$archive" ]
|
||||
@ -46,8 +44,7 @@ teardown_tar() {
|
||||
|
||||
@test "gzip compression" {
|
||||
setconfig backup.d/test.tar compress gzip
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tgz)
|
||||
[ -s "$archive" ]
|
||||
@ -56,8 +53,7 @@ teardown_tar() {
|
||||
|
||||
@test "bzip2 compression" {
|
||||
setconfig backup.d/test.tar compress bzip
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tar.bz2)
|
||||
[ -s "$archive" ]
|
||||
@ -66,8 +62,7 @@ teardown_tar() {
|
||||
|
||||
@test "xz compression" {
|
||||
setconfig backup.d/test.tar compress xz
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tar.xz)
|
||||
[ -s "$archive" ]
|
||||
@ -76,8 +71,7 @@ teardown_tar() {
|
||||
|
||||
@test "zstd compression" {
|
||||
setconfig backup.d/test.tar compress zstd
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tar.zst)
|
||||
[ -s "$archive" ]
|
||||
@ -86,8 +80,7 @@ teardown_tar() {
|
||||
|
||||
@test "unknown compression, defaults to gzip" {
|
||||
setconfig backup.d/test.tar compress foo
|
||||
run backupninja -f "${BATS_TMPDIR}/backupninja.conf" --now --run "${BATS_TMPDIR}/backup.d/test.tar"
|
||||
[ "$status" -eq 0 ]
|
||||
runaction
|
||||
grep -q "Info: FINISHED: 1 actions run. 0 fatal. 0 error. 1 warning." "${BATS_TMPDIR}/log/backupninja.log"
|
||||
archive=$(find /var/backups/tartest -maxdepth 1 -name bntest-\*.tgz)
|
||||
[ -s "$archive" ]
|
||||
|
Loading…
Reference in New Issue
Block a user