]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Reproduce #3225 about Migration issue when the Job resource is no longer...
authorEric Bollengier <eric@baculasystems.com>
Tue, 15 Jan 2019 08:50:31 +0000 (09:50 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 19 Jan 2019 14:18:37 +0000 (15:18 +0100)
regress/tests/migration-job-no-resource-test [new file with mode: 0755]

diff --git a/regress/tests/migration-job-no-resource-test b/regress/tests/migration-job-no-resource-test
new file mode 100755 (executable)
index 0000000..da2c73a
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory, remove the job definition,
+#   and then migrate it to another device.
+#
+# This script uses the virtual disk autochanger
+#
+TestName="migration-job-no-resource-test"
+JobName=MigrationJobSave
+. scripts/functions
+
+
+scripts/cleanup
+scripts/copy-migration-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+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
+@output /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
+run job=$JobName level=incremental yes
+wait
+messages
+list jobs
+list volumes
+quit
+END_OF_DATA
+
+run_bacula
+
+sed "s/Name = \"$JobName\"/Name = \"No$JobName\"/" $conf/bacula-dir.conf > $tmp/1
+mv $tmp/1 $conf/bacula-dir.conf
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log3.out
+reload
+run job=migrate-job yes
+wait
+messages
+list jobs 
+@$out ${cwd}/tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+check_for_zombie_jobs storage=File
+stop_bacula
+
+grep "Migration Error" $tmp/log3.out > /dev/null
+if [ $? -ne 0 ]; then
+    print_debug "ERROR: Migration termination message should be in Error"
+    estat=1
+fi
+
+check_two_logs
+end_test