From 5884856a9837bb083cb56d6b29d8fd6d437df1d2 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Thu, 4 Jul 2013 14:18:09 +0200 Subject: [PATCH] added regression test for passive mode Signed-off-by: Marco van Wieringen --- DartTestfile.txt.in | 1 + all-dev-tests | 1 + all-disk-tests | 1 + tests/backup-bareos-passive-test | 113 +++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100755 tests/backup-bareos-passive-test diff --git a/DartTestfile.txt.in b/DartTestfile.txt.in index 2e51056..f500cc5 100644 --- a/DartTestfile.txt.in +++ b/DartTestfile.txt.in @@ -5,6 +5,7 @@ ADD_TEST(disk:accurate-test "@regressdir@/tests/accurate-test") ADD_TEST(disk:allowcompress-test "@regressdir@/tests/allowcompress-test") ADD_TEST(disk:auto-label-test "@regressdir@/tests/auto-label-test") ADD_TEST(disk:backup-bareos-test "@regressdir@/tests/backup-bareos-test") +ADD_TEST(disk:backup-bareos-passive-test "@regressdir@/tests/backup-bareos-passive-test") ADD_TEST(disk:backup-to-null "@regressdir@/tests/backup-to-null") ADD_TEST(disk:base-job-test "@regressdir@/tests/base-job-test") ADD_TEST(disk:bconsole-test "@regressdir@/tests/bconsole-test") diff --git a/all-dev-tests b/all-dev-tests index d367530..ec841bd 100755 --- a/all-dev-tests +++ b/all-dev-tests @@ -13,6 +13,7 @@ rm -f dumps/* ./run tests/allowcompress-test ./run tests/auto-label-test ./run tests/backup-bareos-test +./run tests/backup-bareos-passive-test ./run tests/base-job-test ./run tests/bextract-test ./run tests/bconsole-test diff --git a/all-disk-tests b/all-disk-tests index 41f533f..83bb994 100755 --- a/all-disk-tests +++ b/all-disk-tests @@ -13,6 +13,7 @@ rm -f dumps/* ./run tests/accurate-test ./run tests/auto-label-test ./run tests/backup-bareos-test +./run tests/backup-bareos-passive-test ./run tests/bextract-test ./run tests/bconsole-test ./run tests/base-job-test diff --git a/tests/backup-bareos-passive-test b/tests/backup-bareos-passive-test new file mode 100755 index 0000000..a68b419 --- /dev/null +++ b/tests/backup-bareos-passive-test @@ -0,0 +1,113 @@ +#!/bin/sh +# +# Run a simple backup of the Bareos build directory +# then restore it. +# +TestName="backup-bareos-passive-test" +JobName=backup +. scripts/functions + +scripts/cleanup +scripts/copy-confs + +# +# Zap out any schedule in default conf file so that +# it doesn't start during our test +# +outf="$tmp/sed_tmp" +echo "s% Schedule =%# Schedule =%g" >${outf} +cp $scripts/bareos-dir.conf $tmp/1 +sed -f ${outf} $tmp/1 >$scripts/bareos-dir.conf + + +# set passive to yes: +cp $scripts/bareos-dir.conf $tmp/1 +echo 's#^Client {#Client { \n passive = yes \n#g' >${outf} +sed -f ${outf} $tmp/1 >$scripts/bareos-dir.conf + +# set compatible to no in fd.conf +cp $scripts/bareos-fd.conf $tmp/1 +echo 's#^FileDaemon {#FileDaemon { \n compatible = no \n#g' >${outf} +sed -f ${outf} $tmp/1 >$scripts/bareos-fd.conf + + + + +change_jobname BackupClient1 $JobName +start_test + +cat <$tmp/bconcmds +@$out /dev/null +messages +@$out $tmp/log1.out +setdebug level=100 storage=File +label volume=TestVolume001 storage=File pool=File +run job=$JobName yes +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +@sleep 1 +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +@sleep 1 +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +wait +messages +@# +@# now do a restore +@# +@$out $tmp/log2.out +restore where=$tmp/bareos-restores select all done +yes +wait +messages +quit +END_OF_DATA + +run_bareos +check_for_zombie_jobs storage=File +stop_bareos + +cat <$tmp/bconcmds +@$out /dev/null +messages +@$out $tmp/log1.out +@#setdebug level=100 storage=File +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out $tmp/log2.out +restore where=$tmp/bareos-restores select all done +yes +wait +messages +quit +END_OF_DATA + +# +# Now do a second backup after making a few changes +# +touch ${cwd}/build/src/dird/*.c +echo "test test" > ${cwd}/build/src/dird/xxx +# + +run_bareos +check_for_zombie_jobs storage=File +stop_bareos + +check_two_logs +check_restore_diff +end_test