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 @##############################################
50 @# AllowDuplicates = Yes, both jobs should work
51 @##############################################
52 run comment="Should work" level=Full job=AllowDuplicateYes yes
54 run comment="Should work" level=Full job=AllowDuplicateYes yes
58 @###############################################################
59 @# Run two jobs with the same level and see wich one is canceled
60 @###############################################################
61 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
63 run comment="Should fail" level=Full job=CancelLowerLevelDuplicatesYes yes
66 @####################################################################
67 @# Run two jobs with the different level and see wich one is canceled
68 @####################################################################
69 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
71 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
74 @#####################################################################################
75 @# Run two jobs with the different level and see wich one is canceled (reversed order)
76 @#####################################################################################
77 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
79 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
83 @####################################################################
84 @# Run two jobs, the second one can't cancel the 1st, and should fail
85 @####################################################################
86 run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
88 run comment="Should fail" level=Full job=CancelQueueDuplicatesYes yes
91 @#################################################################
92 @# The first job should stay queued, the second one will cancel it
93 @#################################################################
94 run comment="Should fail" level=Full job=CancelQueueDuplicatesYes when="$when" yes
96 run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
100 @########################################
101 @# The second job will kill the first one
102 @########################################
103 run comment="Should fail" level=Full job=CancelRunningDuplicatesYes yes
105 run comment="Should work" level=Full job=CancelRunningDuplicatesYes yes
109 @##########################
110 @# The second job won't run
111 @##########################
112 run comment="Should work" level=Full job=CancelRunningDuplicatesNo yes
114 run comment="Should fail" level=Full job=CancelRunningDuplicatesNo yes
119 SELECT JobId, Name, Level, Comment, JobStatus from Job
120 WHERE Comment='Should fail' and JobStatus='T' ORDER By JobId;
124 SELECT JobId, Name, Level, Comment, JobStatus from Job
125 WHERE Comment='Should work' and JobStatus != 'T' ORDER By JobId;
129 SELECT JobId, Name, Level, Comment, JobStatus from Job order by JobId;
135 check_for_zombie_jobs storage=File
141 grep '^| [0-9]' $tmp/log7.out > /dev/null
143 print_debug "E: Found errors in $tmp/log7.out"
144 print_debug `cat $tmp/log7.out`
148 grep '^| [0-9]' $tmp/log8.out > /dev/null
150 print_debug "E: Found errors in $tmp/log8.out"
151 print_debug `cat $tmp/log8.out`