]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxtime-test
Tweak cleaner output in accurate-test
[bacula/bacula] / regress / tests / maxtime-test
1 #!/bin/sh
2 #
3 #  Test MaxWaitTime, MaxRunTime and MaxStartDelay
4 #
5
6 TestName="maxtime-test"
7 JobName=backup
8
9 . scripts/functions
10
11 copy_test_confs
12
13 rm -f ${cwd}/tmp/RUN*log
14 cp -f ${cwd}/scripts/bacula-dir.conf.maxtime ${cwd}/bin/bacula-dir.conf
15 WHEN=`date '+%Y-%m-%d %H:%M:%S'`
16
17 echo "${cwd}/build/po" >${cwd}/tmp/file-list
18
19 start_test
20
21 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
22 @$out /dev/null
23 messages
24 @$out ${cwd}/tmp/log1.out
25 label volume=TestVolume001 pool=PoolA
26 @$out ${cwd}/tmp/RUN_MAXTIME.log
27 @# no media => have to wait
28 run job=RUN_MAXWAITTIME comment="Should fail" pool=Default yes
29 @sleep 2
30 @# storage is used by RUN_MAXWAITTIME => have to wait
31 run job=RUN_MAXSTARTDELAY comment="Should fail" pool=PoolA when="$WHEN" yes
32 @sleep 2
33 @# storage is used by the first MAXWAITTIME, but should work
34 run job=RUN_MAXWAITTIME comment="Should work" pool=PoolA yes
35 @sleep 60
36 label volume=TestVolume002 pool=Default
37 mount
38 @sleep 2
39 mount
40 wait
41 messages
42 run job=RUN_MAXRUNTIME comment="Should fail" pool=PoolA yes
43 wait
44 messages
45 st dir
46 quit
47 END_OF_DATA
48
49 (mkfifo ${cwd}/tmp/fifo 
50  mkfifo ${cwd}/tmp/fifo2
51  mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
52
53 run_bacula
54 check_for_zombie_jobs storage=File
55 stop_bacula
56
57 rm -f ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
58
59 dstat=0
60 bstat=0
61 rstat=0
62 touch ${cwd}/tmp/log2.out
63
64 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
65 if [ $? -eq 0 ]
66 then
67     [ "$debug" = 1 ] && echo MAXWAITTIME ok
68 else
69    echo "MAXWAITTIME in error"
70    bstat=1
71 fi
72
73 grep -e '2: Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log > /dev/null
74 f=$?
75
76 grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
77 s=$?
78
79 if [ $f -eq 0 -a $s -ne 0 ]
80 then
81     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
82 else
83    echo "MAXSTARTDELAY in error"
84    bstat=1
85 fi
86
87 grep -e '4: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
88 if [ $? -eq 0 ]
89 then
90     [ "$debug" = 1 ] && echo MAXRUNTIME ok
91 else
92    echo "MAXRUNTIME in error"
93    bstat=1
94 fi
95
96 grep 'Termination: *Backup OK' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
97 if [ $? -eq 0 ]
98 then
99     [ "$debug" = 1 ] && echo MAXRUNTIME2 ok
100 else
101    echo "MAXRUNTIME2 in error"
102    bstat=1
103 fi
104
105
106 end_test