]> git.sur5r.net Git - bacula/bacula/commitdiff
regress: Add test for new PurgeMigrateJob option
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 25 Nov 2010 15:08:52 +0000 (16:08 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:37:12 +0000 (14:37 +0200)
regress/tests/migration-job-purge-test [new file with mode: 0755]

diff --git a/regress/tests/migration-job-purge-test b/regress/tests/migration-job-purge-test
new file mode 100755 (executable)
index 0000000..843b30e
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory then migrate it
+#   to another device, and see if PurgeMigrateJob works as expected.
+#
+# This script uses the virtual disk autochanger
+#
+TestName="migration-job-purge-test"
+JobName=MigrationJobSave
+. scripts/functions
+
+
+scripts/cleanup
+scripts/copy-migration-confs
+scripts/prepare-disk-changer
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "PurgeMigrateJob", "yes", "Job", "migrate-job")'
+
+start_test
+
+#
+# Note, we first backup into Pool Default, 
+#          then Migrate into Pool Full. 
+#              Pool Default uses Storage=File
+#              Pool Full    uses Storage=DiskChanger
+
+# Write out bconsole commands
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+setdebug level=000 storage=File
+label storage=File volume=FileVolume001 Pool=Default
+label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
+label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
+@# run two jobs (both will be migrated)
+run job=$JobName yes
+run job=$JobName yes
+wait
+list jobs
+list volumes
+@#setdebug level=100 dir
+@# should migrate two jobs
+@#setdebug level=51 storage=DiskChanger
+run job=migrate-job yes
+wait
+messages
+@# purge volume=FileVolume001
+list jobs 
+list volumes
+list joblog jobid=6
+wait
+@#
+@# Now do another backup, but level Incremental
+@#
+run job=$JobName level=Incremental yes
+wait
+messages
+@#
+@# This final job that runs should be Incremental and
+@# not upgraded to full.
+list jobs
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+list volumes 
+restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
+unmark *
+mark *
+done
+yes
+list volumes
+wait
+messages
+@$out ${cwd}/tmp/log3.out
+list jobid=1
+list jobid=2
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+
+# Shouldn't find MigrationJobSave jobid 1 or 2 in log3.out
+grep MigrationJobSave $tmp/log3.out
+if [ $? -eq 0 ]; then
+    print_debug "ERROR: found purged jobids in $tmp/log3.out"
+    estat=1
+fi
+
+end_test