4 TestName="duplicate-job-test"
8 scripts/copy-test-confs
9 echo "${cwd}/build/technotes" >${cwd}/tmp/file-list
12 # extract a Job and add a runscript on it
13 perl -Mscripts::functions \
14 -e "extract_resource('$conf/bacula-dir.conf', 'Job', 'CompressedTest')" \
15 | sed 's%Standard%Standard; ClientRunBeforeJob="sleep 6"%' > $tmp/1
19 echo 's%CompressedTest%AllowDuplicateYes%' > $outf
20 echo 's%Backup%Backup; AllowDuplicateJobs = yes%' >> $outf
21 sed -f $outf $tmp/1 >> $conf/bacula-dir.conf
23 echo 's%CompressedTest%CancelLowerLevelDuplicatesYes%' > $outf
24 echo 's%Backup%Backup; AllowDuplicateJobs = no; CancelLowerLevelDuplicates=yes%' >> $outf
25 sed -f $outf $tmp/1 >> $conf/bacula-dir.conf
27 echo 's%CompressedTest%CancelQueueDuplicatesYes%' > $outf
28 echo 's%Backup%Backup; AllowDuplicateJobs = no;CancelLowerLevelDuplicates=no;CancelQueuedDuplicates=yes %' >> $outf
29 sed -f $outf $tmp/1 >> $conf/bacula-dir.conf
31 echo 's%CompressedTest%CancelRunningDuplicatesYes%' > $outf
32 echo 's%Backup%Backup; AllowDuplicateJobs = no;CancelLowerLevelDuplicates=no;CancelQueuedDuplicates=no; CancelRunningDuplicates=yes%' >> $outf
33 sed -f $outf $tmp/1 >> $conf/bacula-dir.conf
35 echo 's%CompressedTest%CancelRunningDuplicatesNo%' > $outf
36 echo 's%Backup%Backup; AllowDuplicateJobs = no;CancelLowerLevelDuplicates=no;CancelQueuedDuplicates=no; CancelRunningDuplicates=no%' >> $outf
37 sed -f $outf $tmp/1 >> $conf/bacula-dir.conf
39 when=`perl -MPOSIX -e "print strftime('%F %T', localtime(time+300))"`
43 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
46 @$out ${cwd}/tmp/log1.out
48 label storage=File volume=TestVolume001
49 @#setdebug level=100 storage=File
50 @##############################################
51 @# AllowDuplicates = Yes, both jobs should work
52 @##############################################
53 run comment="Should work" level=Full job=AllowDuplicateYes yes
55 run comment="Should work" level=Full job=AllowDuplicateYes yes
59 @###############################################################
60 @# Run two jobs with the same level and see wich one is canceled
61 @###############################################################
62 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
64 run comment="Should fail" level=Full job=CancelLowerLevelDuplicatesYes yes
67 @####################################################################
68 @# Run two jobs with the different level and see wich one is canceled
69 @####################################################################
70 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
72 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
75 run comment="Should fail" level=Differential job=CancelLowerLevelDuplicatesYes yes
77 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
80 run comment="Should work" level=Differential job=CancelLowerLevelDuplicatesYes yes
82 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
85 @#####################################################################################
86 @# Run two jobs with the different level and see wich one is canceled (reversed order)
87 @#####################################################################################
88 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
90 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
94 @####################################################################
95 @# Run two jobs, the second one can't cancel the 1st, and should fail
96 @####################################################################
97 run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
99 run comment="Should fail" level=Full job=CancelQueueDuplicatesYes yes
102 @#################################################################
103 @# The first job should stay queued, the second one will cancel it
104 @#################################################################
105 run comment="Should fail" level=Full job=CancelQueueDuplicatesYes when="$when" yes
107 run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
111 @########################################
112 @# The second job will kill the first one
113 @########################################
114 run comment="Should fail" level=Full job=CancelRunningDuplicatesYes yes
116 run comment="Should work" level=Full job=CancelRunningDuplicatesYes yes
120 @##########################
121 @# The second job won't run
122 @##########################
123 run comment="Should work" level=Full job=CancelRunningDuplicatesNo yes
125 run comment="Should fail" level=Full job=CancelRunningDuplicatesNo yes
130 SELECT JobId, Name, Level, Comment, JobStatus from Job
131 WHERE Comment='Should fail' and JobStatus='T' ORDER By JobId;
135 SELECT JobId, Name, Level, Comment, JobStatus from Job
136 WHERE Comment='Should work' and JobStatus != 'T' ORDER By JobId;
140 SELECT JobId, Name, Level, Comment, JobStatus from Job order by JobId;
146 check_for_zombie_jobs storage=File
152 grep '^| [0-9]' $tmp/log7.out > /dev/null
154 print_debug "E: Found errors in $tmp/log7.out"
155 print_debug `cat $tmp/log7.out`
159 grep '^| [0-9]' $tmp/log8.out > /dev/null
161 print_debug "E: Found errors in $tmp/log8.out"
162 print_debug `cat $tmp/log8.out`