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