]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/migration-time-test
ebl Add more tests in migration time test (like for copy time test)
[bacula/bacula] / regress / tests / migration-time-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then migrate it
4 #   to another device.
5 #
6 # This script uses the virtual disk autochanger
7 #
8 TestName="migration-time-test"
9 JobName=MigrationJobSave
10 . scripts/functions
11
12
13 scripts/cleanup
14 scripts/copy-migration-confs
15 scripts/prepare-disk-changer
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17
18 change_jobname NightlySave $JobName
19 start_test
20
21 #
22 # Note, we first backup into Pool Default, 
23 #          then Migrate into Pool Full. 
24 #              Pool Default uses Storage=File
25 #              Pool Full    uses Storage=DiskChanger
26
27 # Write out bconsole commands
28 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
29 @output
30 messages
31 @$out ${cwd}/tmp/log1.out
32 label storage=File volume=FileVolume001 Pool=Default
33 label storage=File volume=FileVolume002 Pool=Special
34 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
35 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
36 list volumes
37 @# run three jobs
38 run job=$JobName pool=Special level=Full yes
39 run job=$JobName level=Full yes
40 run job=$JobName level=Full yes
41 wait
42 update volume=FileVolume001 VolStatus=Used
43 update volume=FileVolume002 VolStatus=Used
44 llist jobid=2,3
45 list jobs
46 list volumes
47 @#setdebug level=20 dir
48 @# should migrate only jobid=2 and 3
49 run job=migrate-time yes
50 wait
51 messages
52 wait
53 list jobs
54 list volumes
55 @# 
56 @# now do a restore
57 @#
58 @$out ${cwd}/tmp/log2.out
59 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
60 unmark *
61 mark *
62 done
63 yes
64 wait
65 messages
66 @output
67 quit
68 END_OF_DATA
69
70 run_bacula
71 check_for_zombie_jobs storage=File
72 stop_bacula
73
74 for i in 1 2 3; do
75     get_mig_info $i ${cwd}/tmp/log1.out
76
77     if [ "$i" -eq 1 -a -n "$RET" ]; then
78         bstat=2
79         print_debug "The first job should not have been copied"
80
81     elif [ "$i" -ne 1 -a -z "$RET" ]; then
82         bstat=2
83         print_debug "Other job should have been copied"
84     fi
85 done
86
87 check_two_logs
88 check_restore_diff
89 end_test