]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/vtape-big-test-changer
Make copy-job test handle one more job
[bacula/bacula] / regress / tests / vtape-big-test-changer
1 #!/bin/sh
2 #
3 # Run backups with dummy tape driver
4 # This test setups an Autochanger with 800 slots
5 # and 5 drives (3 LTO3 and 2 LTO1)
6 #
7 # TAPE_DRIVE="$cwd/working/ach/drive0"
8 # TAPE_DRIVE1="$cwd/working/ach/drive0"
9 # AUTOCHANGER="$cwd/working/ach/conf"
10 # USE_VTAPE=yes
11 # AUTOCHANGER_SCRIPT=disk-changer
12
13
14 TestName="vtape-test-changer"
15 JobName=backup
16 . scripts/functions
17
18 require_vtape
19
20 scripts/cleanup
21 scripts/copy-tape-confs
22 cp $rscripts/bacula-dir-vtape.conf $conf/bacula-dir.conf
23 cp $rscripts/bacula-sd-vtape.conf $conf/bacula-sd.conf
24 scripts/prepare-fake-autochanger 300
25
26 perl -Mscripts::functions \
27     -e "set_maximum_concurrent_jobs('$conf/bacula-dir.conf', 100)"
28 perl -Mscripts::functions \
29     -e "set_maximum_concurrent_jobs('$conf/bacula-sd.conf', 100)"
30 perl -Mscripts::functions \
31     -e "set_maximum_concurrent_jobs('$conf/bacula-fd.conf', 100)"
32
33 echo "${cwd}/build" >${cwd}/tmp/file-list
34
35 start_test
36
37 when1=`perl -Mscripts::functions -e "get_time(30)"`
38 when2=`perl -Mscripts::functions -e "get_time(45)"`
39
40 clientname=`awk '/Name = .*-fd/ { if (!ok) { print $3 ; ok=1 } }' bin/bacula-dir.conf`
41
42 perl -Mscripts::functions \
43     -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'NightlySave')" > $tmp/1
44
45 for i in `seq 4 40`; do
46     sed "s%NightlySave%NightlySave$i%" $tmp/1 >> $conf/bacula-dir.conf
47 done
48
49
50
51 # Catalog record for cleaning tape "CLN01" successfully created.
52 # CLN01      | Cleaning
53
54 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 @$out ${cwd}/tmp/log7.out
56 label barcodes pool=Scratch slots=1-300 storage=LTO3 drive=0
57 yes
58 messages
59 list volumes
60 @$out ${cwd}/tmp/log1.out
61 run level=full storage=LTO3 when="$when1" job=NightlySave  pool=Inc     yes
62 run level=full storage=LTO3 when="$when1" job=NightlySave1 pool=Full    yes
63 run level=full storage=LTO3 when="$when1" job=NightlySave2 pool=Default yes
64 run level=full storage=LTO3 when="$when1" job=NightlySave3 pool=Default yes
65 run level=full storage=LTO3 when="$when1" job=NightlySave4 pool=Inc     yes
66 run level=full storage=LTO3 when="$when1" job=NightlySave5 pool=Full    yes
67 run level=full storage=LTO3 when="$when1" job=NightlySave6 pool=Default yes
68 run level=full storage=LTO3 when="$when1" job=NightlySave7 pool=Default yes
69 run level=full storage=LTO3 when="$when1" job=NightlySave8 pool=Inc     yes
70 run level=full storage=LTO3 when="$when1" job=NightlySave9 pool=Full    yes
71 @#run level=full storage=LTO3 when="$when1" job=NightlySave10  pool=Default yes
72 @#run level=full storage=LTO3 when="$when1" job=NightlySave11  pool=Default yes
73 @#run level=full storage=LTO3 when="$when1" job=NightlySave12  pool=Inc     yes
74 @#run level=full storage=LTO3 when="$when1" job=NightlySave13  pool=Full    yes
75 @#run level=full storage=LTO3 when="$when1" job=NightlySave14  pool=Default yes
76 @#run level=full storage=LTO3 when="$when1" job=NightlySave15  pool=Default yes
77 @#run level=full storage=LTO3 when="$when1" job=NightlySave16  pool=Inc     yes
78 @#run level=full storage=LTO3 when="$when1" job=NightlySave17  pool=Full    yes
79 @#run level=full storage=LTO3 when="$when1" job=NightlySave18  pool=Default yes
80 @#run level=full storage=LTO3 when="$when1" job=NightlySave19  pool=Default yes
81 @#run level=full storage=LTO3 when="$when1" job=NightlySave20  pool=Inc     yes
82 @#run level=full storage=LTO3 when="$when1" job=NightlySave21  pool=Full    yes
83 @#run level=full storage=LTO3 when="$when1" job=NightlySave22  pool=Default yes
84 @#run level=full storage=LTO3 when="$when1" job=NightlySave23  pool=Default yes
85 @#run level=full storage=LTO3 when="$when1" job=NightlySave24  pool=Inc     yes
86 @#run level=full storage=LTO3 when="$when1" job=NightlySave25  pool=Full    yes
87 @#run level=full storage=LTO3 when="$when1" job=NightlySave26  pool=Default yes
88 @#run level=full storage=LTO3 when="$when1" job=NightlySave27  pool=Default yes
89 @#run level=full storage=LTO3 when="$when1" job=NightlySave28  pool=Inc     yes
90 @#run level=full storage=LTO3 when="$when1" job=NightlySave29  pool=Full    yes
91 @#run level=full storage=LTO3 when="$when1" job=NightlySave30  pool=Default yes
92 @#run level=full storage=LTO3 when="$when1" job=NightlySave31  pool=Default yes
93 @#run level=full storage=LTO3 when="$when1" job=NightlySave32  pool=Inc     yes
94 @#run level=full storage=LTO3 when="$when1" job=NightlySave33  pool=Full    yes
95 @#run level=full storage=LTO3 when="$when1" job=NightlySave34  pool=Default yes
96 @#run level=full storage=LTO3 when="$when1" job=NightlySave35  pool=Default yes
97 @sleep 50
98 @#wait jobid=1
99 @#restore client=$clientname fileset="Full Set" pool=Inc where=${cwd}/tmp/bacula-restores1 select all done
100 @#yes
101 @#sleep 30
102 cancel
103 1
104 @sleep 1
105 cancel
106 1
107 @sleep 1
108 cancel
109 1
110 @sleep 1
111 cancel
112 1
113 wait
114 messages
115 quit
116 END_OF_DATA
117
118 run_bacula
119 check_for_zombie_jobs storage=LTO3 client=$clientname
120
121 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
122 @$out ${cwd}/tmp/log2.out  
123 @# 
124 @# now do a restore
125 @#
126 restore client=$clientname fileset="Full Set" pool=Full where=${cwd}/tmp/bacula-restores select all done
127 yes
128 wait
129 messages
130 END_OF_DATA
131
132 run_bconsole
133 check_for_zombie_jobs storage=LTO3 client=$clientname
134
135 # test update slots
136 # remove volume vol20 from autochanger
137 grep -v vol20 ${cwd}/working/ach/barcodes > ${cwd}/tmp/1
138 cp ${cwd}/tmp/1 ${cwd}/working/ach/barcodes
139
140 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
141 @$out ${cwd}/tmp/log3.out
142 list volume=vol20
143 update slots slots=5-40 storage=LTO3 drive=3
144 list volume=vol20
145 END_OF_DATA
146
147 run_bconsole
148
149 stop_bacula
150
151 check_two_logs
152 check_restore_diff
153
154 # get InChanger flag
155 RES=`awk -F'|' '/vol20 .+(Full|Append)/ { print $11 }' ${cwd}/tmp/log3.out`
156 set $RES
157 if [ $1 -eq $2 ]; then
158     print_debug "ERROR: Error in update slots"
159     bstat=1
160 fi
161
162 grep LTO1_5 tmp/log1.out > /dev/null
163 if test $? = 0; then
164     print_debug "ERROR: AutoSelect option broken"
165     bstat=1
166 fi
167
168 grep 'Error: Re-read' tmp/log1.out > /dev/null
169 if test $? = 0; then
170     print_debug "ERROR: Found Re-read errors"
171     #bstat=1
172 fi
173
174 end_test