]> git.sur5r.net Git - bacula/bacula/commitdiff
Add new restart regression tests from master
authorKern Sibbald <kern@sibbald.com>
Mon, 21 Feb 2011 11:06:15 +0000 (12:06 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:26 +0000 (14:43 +0200)
regress/tests/restart-accurate-job-test [new file with mode: 0755]
regress/tests/restart2-job-test [new file with mode: 0755]

diff --git a/regress/tests/restart-accurate-job-test b/regress/tests/restart-accurate-job-test
new file mode 100755 (executable)
index 0000000..5c4cf26
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Run a backup of the build directory but force it to have
+#   a comm error, and check that it restarts correctly.
+#
+TestName="restart-accurate-job-test"
+JobName=RestartJob
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-test-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', 'RestartJob')"
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+label storage=File volume=TestVolume001
+setdebug level=0 trace=0 hangup=100 client
+@#setdebug level=20 dir
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula  
+
+scripts/check_for_zombie_jobs storage=File
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+setdebug level=0 trace=0 hangup=50 client
+@exec "sh -c 'touch $cwd/build/po/*'"
+@exec "sh -c 'touch $cwd/build/src/dird/*'"
+run job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore where=$tmp/bacula-restores storage=File select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+scripts/check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test
diff --git a/regress/tests/restart2-job-test b/regress/tests/restart2-job-test
new file mode 100755 (executable)
index 0000000..8119028
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# Run a backup of the build directory but force it to have
+#   a comm error, and check that it restarts correctly.
+#
+TestName="restart2-job-test"
+JobName=RestartJob
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-test-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+setbandwidth limit=1000 client
+@#setdebug level=0 trace=0 hangup=100 client
+@#setdebug level=20 dir
+label storage=File volume=TestVolume001
+run job=$JobName yes
+@sleep 15
+status client
+END_OF_DATA
+
+run_bacula  
+
+sleep 5
+$bin/bacula-ctl-fd stop
+sleep 5
+$bin/bacula-ctl-fd start
+sleep 5
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole  
+
+scripts/check_for_zombie_jobs storage=File
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+messages
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore where=$tmp/bacula-restores storage=File select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+scripts/check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+
+grep "Sending Accurate" $tmp/log1.out >/dev/null
+if [ $? != 0 ]; then
+    print_debug "ERROR: Second job should use Accurate"
+    estat=1
+fi
+
+end_test