]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-2job-test
regress: Add more complex systemstate test with full restore
[bacula/bacula] / regress / tests / 2drive-2job-test
1 #!/bin/sh
2 #
3 # Set prefer mounted volumes to no to try to force use of
4 #   the drive swap code.
5 #
6 # This script uses the virtual disk autochanger and two drives
7 #
8 TestName="2drive-2job"
9 JobName="2drive2job"
10 . scripts/functions
11
12 scripts/cleanup
13 scripts/copy-2disk-drive-confs
14 scripts/prepare-disk-changer
15 CLIENT=2drive2disk
16
17 change_jobname NightlySave $JobName
18 start_test
19
20 echo "${cwd}/build" >${cwd}/tmp/file-list
21
22 # Turn off Prefer Mounted Volumes so we use 2 drives
23 outf="${cwd}/tmp/sed_tmp"
24 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
25 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
26 # Comment the next line out to write everything to one drive
27 #  otherwise, it writes the two jobs to different drives
28 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
29
30 # Write out bconsole commands
31 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
32 @$out /dev/null
33 messages
34 @$out ${cwd}/tmp/log1.out
35 label storage=tape volume=TestVolume001 slot=2 Pool=Default drive=0
36 label storage=tape volume=TestVolume002 slot=1 Pool=Default drive=1
37 status storage=tape
38 @#unmount storage=tape drive=0
39 @#unmount storage=tape drive=1
40 @#mount storage=tape slot=2 drive=0
41 @#mount storage=tape slot=1 drive=1
42 status storage=tape
43 setdebug level=120 storage=tape
44 run job=$JobName level=Full yes
45 @sleep 2
46 run job=$JobName level=Full yes
47 status storage=tape
48 wait
49 list volumes
50 list jobs
51 status storage=tape
52 messages
53 quit
54 END_OF_DATA
55
56 run_bacula
57
58 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
59 @$out /dev/null
60 messages
61 @# now do a restore
62 @#
63 @$out ${cwd}/tmp/log2.out
64 @#unmount storage=tape drive=0
65 @#unmount storage=tape drive=1
66 @#mount storage=tape slot=1 drive=0
67 @#mount storage=tape slot=2 drive=1
68 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
69 yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74
75 run_bconsole
76 check_for_zombie_jobs storage=tape
77 stop_bacula
78
79 check_two_logs
80 check_restore_diff
81
82 end_test