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