3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Test MaxWaitTime, MaxRunTime and MaxStartDelay
11 TestName="maxtime-test"
18 rm -f ${cwd}/tmp/RUN*log
19 cp -f ${cwd}/scripts/bacula-dir.conf.maxtime ${cwd}/bin/bacula-dir.conf
20 WHEN=`date '+%Y-%m-%d %H:%M:%S'`
22 echo "${cwd}/build/po" >${cwd}/tmp/file-list
26 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
29 @$out ${cwd}/tmp/log1.out
30 label volume=TestVolume001 pool=PoolA
31 @$out ${cwd}/tmp/RUN_MAXTIME.log
32 @# no media => have to wait
34 run job=RUN_MAXWAITTIME comment="Should fail" pool=Default yes
36 @# storage is used by RUN_MAXWAITTIME => have to wait
38 run job=RUN_MAXSTARTDELAY comment="Should fail" pool=PoolA when="$WHEN" yes
40 @# storage is used by the first MAXWAITTIME, but should work
42 run job=RUN_MAXWAITTIME comment="Should work" pool=PoolA yes
44 label volume=TestVolume002 pool=Default
51 run job=RUN_MAXRUNTIME comment="Should fail" pool=PoolA yes
60 (mkfifo ${cwd}/tmp/fifo
61 mkfifo ${cwd}/tmp/fifo2
62 mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
65 check_for_zombie_jobs storage=File
68 rm -f ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
73 touch ${cwd}/tmp/log2.out
75 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
78 [ "$debug" = 1 ] && echo MAXWAITTIME ok
80 echo "MAXWAITTIME in error"
84 grep -e '2: Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log > /dev/null
87 grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
90 if [ $f -eq 0 -a $s -ne 0 ]
92 [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
94 echo "MAXSTARTDELAY in error"
98 grep -e '4: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
101 [ "$debug" = 1 ] && echo MAXRUNTIME ok
103 echo "MAXRUNTIME in error"
107 grep 'Termination: *Backup OK' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
110 [ "$debug" = 1 ] && echo MAXRUNTIME2 ok
112 echo "MAXRUNTIME2 in error"