]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxtime-test
4dc97515223416a74e90ba11eafb580e51ec5955
[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 ${cwd}/tmp/log1.out
23 messages
24 label volume=TestVolume001 pool=PoolA
25 @$out ${cwd}/tmp/RUN_MAXTIME.log
26 @# no media => have to wait
27 run job=RUN_MAXWAITTIME comment="Should fail" pool=Default yes
28 @sleep 2
29 @# storage is used by RUN_MAXWAITTIME => have to wait
30 run job=RUN_MAXSTARTDELAY comment="Should fail" pool=PoolA when="$WHEN" yes
31 @sleep 2
32 @# storage is used by the first MAXWAITTIME, but should work
33 run job=RUN_MAXWAITTIME comment="Should work" pool=PoolA yes
34 @sleep 60
35 label volume=TestVolume002 pool=Default
36 mount
37 wait
38 messages
39 run job=RUN_MAXRUNTIME comment="Should fail" pool=PoolA yes
40 wait
41 messages
42 st dir
43 quit
44 END_OF_DATA
45
46 (mkfifo ${cwd}/tmp/fifo 
47  mkfifo ${cwd}/tmp/fifo2
48  mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
49
50 run_bacula
51 check_for_zombie_jobs storage=File
52 stop_bacula
53
54 rm -f ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
55
56 dstat=0
57 bstat=0
58 rstat=0
59 touch ${cwd}/tmp/log2.out
60
61 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
62 if [ $? -eq 0 ]
63 then
64     [ "$debug" = 1 ] && echo MAXWAITTIME ok
65 else
66    echo "MAXWAITTIME in error"
67    bstat=1
68 fi
69
70 grep -e '2: Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log > /dev/null
71 f=$?
72
73 grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
74 s=$?
75
76 if [ $f -eq 0 -a $s -ne 0 ]
77 then
78     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
79 else
80    echo "MAXSTARTDELAY in error"
81    bstat=1
82 fi
83
84 grep -e '4: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
85 if [ $? -eq 0 ]
86 then
87     [ "$debug" = 1 ] && echo MAXRUNTIME ok
88 else
89    echo "MAXRUNTIME in error"
90    bstat=1
91 fi
92
93 grep 'Termination:*Backup OK' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
94 if [ $? -eq 0 ]
95 then
96     [ "$debug" = 1 ] && echo MAXRUNTIME2 ok
97 else
98    echo "MAXRUNTIME2 in error"
99    bstat=1
100 fi
101
102
103 end_test