]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxtime-test
Partial work on virtual-backup2-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 bin/bacula-dir.conf
14 rm -f ${cwd}/tmp/RUN*log
15 /bin/cp -f scripts/bacula-dir.conf.maxtime bin/bacula-dir.conf
16 WHEN=`date '+%Y-%m-%d %H:%M:%S'`
17
18 echo "${cwd}/build/po" >${cwd}/tmp/file-list
19
20 start_test
21
22 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
23 @$out /dev/null
24 messages
25 label volume=TestVolume001 pool=PoolA
26 @$out ${cwd}/tmp/RUN_MAXTIME.log
27 @# no media => have to wait
28 run job=RUN_MAXWAITTIME pool=Default yes
29 @sleep 2
30 @# storage is used by RUN_MAXWAITTIME => have to wait
31 run job=RUN_MAXSTARTDELAY pool=PoolA when="$WHEN" yes
32 wait
33 messages
34 run job=RUN_MAXRUNTIME pool=PoolA yes
35 wait
36 messages
37 st dir
38 quit
39 END_OF_DATA
40
41 (mkfifo ${cwd}/tmp/fifo 
42  mkfifo ${cwd}/tmp/fifo2
43  mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
44
45 run_bacula
46 check_for_zombie_jobs storage=File
47 stop_bacula
48
49 rm ${cwd}/tmp/fifo ${cwd}/tmp/fifo2 ${cwd}/tmp/fifo3
50
51 export dstat=0
52 export bstat=0
53 export rstat=0
54 touch ${cwd}/tmp/log1.out
55
56 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
57 if [ $? -eq 0 ]
58 then
59     [ "$debug" = 1 ] && echo MAXWAITTIME ok
60 else
61    echo "MAXWAITTIME in error"
62    bstat=1
63 fi
64
65 grep -e '2: Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log > /dev/null
66 f=$?
67
68 grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
69 s=$?
70
71 if [ $f -eq 0 -a $s -ne 0 ]
72 then
73     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
74 else
75    echo "MAXSTARTDELAY in error"
76    bstat=1
77 fi
78
79 grep -e '3: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
80 if [ $? -eq 0 ]
81 then
82     [ "$debug" = 1 ] && echo MAXRUNTIME ok
83 else
84    echo "MAXRUNTIME in error"
85    bstat=1
86 fi
87
88 end_test