]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxtime-test
ebl Add AUTOCHANGER_SCRIPT variable in prototype.conf (default
[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
55 grep -e '1: Fatal error: Max wait time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
56 if [ $? -eq 0 ]
57 then
58     [ "$debug" = 1 ] && echo MAXWAITTIME ok
59 else
60    echo "MAXWAITTIME in error"
61    bstat=1
62 fi
63
64 grep -e '2: Fatal error: Job canceled because max start delay time exceeded.' ${cwd}/tmp/RUN_MAXTIME.log > /dev/null
65 f=$?
66
67 grep -e 'NEVER start this' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null
68 s=$?
69
70 if [ $f -eq 0 -a $s -ne 0 ]
71 then
72     [ "$debug" = 1 ] && echo MAXSTARTDELAY ok
73 else
74    echo "MAXSTARTDELAY in error"
75    bstat=1
76 fi
77
78 grep -e '3: Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/RUN_MAXTIME.log >/dev/null 
79 if [ $? -eq 0 ]
80 then
81     [ "$debug" = 1 ] && echo MAXRUNTIME ok
82 else
83    echo "MAXRUNTIME in error"
84    bstat=1
85 fi
86
87 end_test