]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/migration-time-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / migration-time-test
index 3e744d4eb92d873d1909664a11de50798ef88452..9758f3c37771801d636ad7654b4671602000d0b5 100755 (executable)
@@ -1,4 +1,9 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 # Run a simple backup of the Bacula build directory then migrate it
 #   to another device.
@@ -12,8 +17,8 @@ JobName=MigrationJobSave
 
 scripts/cleanup
 scripts/copy-migration-confs
-scripts/prepare-two-disks
-echo "${cwd}/build" >/tmp/file-list
+scripts/prepare-disk-changer
+echo "${cwd}/build" >${cwd}/tmp/file-list
 
 change_jobname NightlySave $JobName
 start_test
@@ -25,38 +30,38 @@ start_test
 #              Pool Full    uses Storage=DiskChanger
 
 # Write out bconsole commands
-cat <<END_OF_DATA >tmp/bconcmds
-@output
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
 messages
-@$out tmp/log1.out
+@$out ${cwd}/tmp/log1.out
 label storage=File volume=FileVolume001 Pool=Default
+label storage=File volume=FileVolume002 Pool=Special
 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
 list volumes
 @# run three jobs
-run job=$JobName level=Full yes
+run job=$JobName pool=Special level=Full yes
 run job=$JobName level=Full yes
 run job=$JobName level=Full yes
 wait
 update volume=FileVolume001 VolStatus=Used
-sql
-update Job SET RealEndTime='2004-01-01 12:01:01' WHERE JobId IN (2,3);
-
+update volume=FileVolume002 VolStatus=Used
+@sleep 3
 llist jobid=2,3
 list jobs
 list volumes
+@#setdebug level=20 dir
 @# should migrate only jobid=2 and 3
 run job=migrate-time yes
 wait
 messages
 wait
-purge volume=FileVolume001
 list jobs
 list volumes
 @# 
 @# now do a restore
 @#
-@$out tmp/log2.out
+@$out ${cwd}/tmp/log2.out
 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
 unmark *
 mark *
@@ -64,7 +69,6 @@ done
 yes
 wait
 messages
-@output
 quit
 END_OF_DATA
 
@@ -72,6 +76,19 @@ run_bacula
 check_for_zombie_jobs storage=File
 stop_bacula
 
+for i in 1 2 3; do
+    get_mig_info $i ${cwd}/tmp/log1.out
+
+    if [ "$i" -eq 1 -a -n "$RET" ]; then
+        bstat=2
+        print_debug "The first job should not have been copied"
+
+    elif [ "$i" -ne 1 -a -z "$RET" ]; then
+        bstat=2
+        print_debug "Other job should have been copied"
+    fi
+done
+
 check_two_logs
 check_restore_diff
 end_test