3 # Test different cancel cases
15 # Zap out any schedule in default conf file so that
16 # it doesn't start during our test
19 echo "s% Schedule =%# Schedule =%g" >$outf
20 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
21 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
25 # Add some jobs and fileset for this test
26 cat <<EOF >>${cwd}/bin/bacula-dir.conf
33 file = "\\</path/to/nowhere"
38 ClientRunBeforeJob = "/bin/false"
44 Command = "/bin/false"
51 ClientRunBeforeJob="/bin/sleep 10"
53 Command = "/bin/sleep 600"
61 ClientRunBeforeJob="/bin/sleep 10"
63 Command = "/bin/sleep 40"
71 change_jobname Client1 $JobName
74 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
77 @$out ${cwd}/tmp/logfile1.out
78 @################################################################
79 @# run a first test without volume
80 @# Expect: duration < 60
81 @################################################################
89 @$out ${cwd}/tmp/logfile2.out
90 @################################################################
91 @# run test with a small volume
92 @# Expect: duration < 60
93 @################################################################
94 label volume=TestVolume001 storage=File pool=Default
95 update volume=TestVolume001 MaxVolBytes=1MB
104 @$out ${cwd}/tmp/logfile3.out
105 @################################################################
106 @# run test with 2 jobs in // (limit 1)
107 @# expect that the second job don't stay in the list
108 @# Expect: Job2 not present at the end
109 @################################################################
110 label volume=TestVolume002 storage=File pool=Default
126 @$out ${cwd}/tmp/logfile4.out
127 @################################################################
128 @# test with a broken fileset
129 @# Expect: duration < 20s
130 @################################################################
131 run job=$JobName fileset=FS_ERR yes
137 @$out ${cwd}/tmp/logfile5.out
138 @################################################################
139 @# test with a broken runscript
140 @# Expect: duration < 20s
141 @################################################################
148 @$out ${cwd}/tmp/logfile6.out
149 @################################################################
150 @# test with a broken runscript
151 @# Expect: duration < 20s
152 @################################################################
159 @$out ${cwd}/tmp/logfile7.out
160 @################################################################
161 @# test with a broken runscript and a very long AfterJob
162 @# we break the backup during the ClientRunBeforeJob
163 @# Expect: duration > 550
164 @################################################################
176 @$out ${cwd}/tmp/logfile8.out
177 @################################################################
178 @# test with a broken runscript and a very long AfterJob
179 @# we break the backup during the ClientRunAfterJob
180 @# Expect: duration > 550
182 @################################################################
194 @$out ${cwd}/tmp/logfile9.out
195 @################################################################
196 @# test with a broken runscript and a very long AfterJob
197 @# we break the backup during the backup
198 @# Expect: duration > 550
200 @################################################################
201 update volume=TestVolume002 volstatus=Used
202 label volume=TestVolume003 storage=File pool=Default
203 update volume=TestVolume003 MaxVolBytes=1MB
215 @$out ${cwd}/tmp/logfile10.out
216 @################################################################
217 @# test with a broken runscript and a short AfterJob
218 @# we break the backup during the backup
219 @# Expect: print sleep 40
220 @################################################################
221 update volume=TestVolume003 volstatus=Used
222 label volume=TestVolume004 storage=File pool=Default
223 update volume=TestVolume004 MaxVolBytes=1MB
235 @$out ${cwd}/tmp/logfile20.out
236 @################################################################
237 @# test with a broken connexion between DIR/FD
238 @# the test will run a job that will stop, and we send
239 @# the STOP signal to the FD process
240 @# Expect: duration < 400
241 @################################################################
242 update volume=TestVolume003 volstatus=Used
243 label volume=TestVolume004 storage=File pool=Default
244 update volume=TestVolume004 MaxVolBytes=1MB
253 print_debug "Stopping FD"
254 # stop the bacula-fd and cancel the job
255 kill -STOP $(pidof bacula-fd)
257 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
258 @$out ${cwd}/tmp/logfile20.out
272 kill -CONT $(pidof bacula-fd)
274 check_for_zombie_jobs storage=File
277 # A fileset or runscript error goes fast
278 check_duration ${cwd}/tmp/logfile1.out 30
279 check_duration ${cwd}/tmp/logfile3.out 30
280 check_duration ${cwd}/tmp/logfile4.out 30
281 check_duration ${cwd}/tmp/logfile5.out 30
282 check_duration ${cwd}/tmp/logfile6.out 30
284 check_duration ${cwd}/tmp/logfile8.out 550 gt
285 grep 'ClientAfterJob "/bin/sleep 600"' tmp/logfile8.out >/dev/null
286 if [ $? -ne 0 ]; then
287 print_debug "Can't find ClientAfterJob"
291 check_duration ${cwd}/tmp/logfile9.out 550 gt
292 grep 'ClientAfterJob "/bin/sleep 600"' tmp/logfile9.out >/dev/null
293 if [ $? -ne 0 ]; then
294 print_debug "Can't find ClientAfterJob"
298 grep 'ClientAfterJob "/bin/sleep 40"' tmp/logfile10.out >/dev/null
299 if [ $? -ne 0 ]; then
300 print_debug "Can't find ClientAfterJob"
304 # Verify the broken connection
305 check_duration ${cwd}/tmp/logfile20.out 400