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 run comment="Should fail" level=Differential job=CancelLowerLevelDuplicatesYes yes
76 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
79 run comment="Should work" level=Differential job=CancelLowerLevelDuplicatesYes yes
81 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
84 @#####################################################################################
85 @# Run two jobs with the different level and see wich one is canceled (reversed order)
86 @#####################################################################################
87 run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
89 run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
93 @####################################################################
94 @# Run two jobs, the second one can't cancel the 1st, and should fail
95 @####################################################################
96 run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
98 run comment="Should fail" level=Full job=CancelQueueDuplicatesYes yes
101 @#################################################################
102 @# The first job should stay queued, the second one will cancel it
103 @#################################################################
104 run comment="Should fail" level=Full job=CancelQueueDuplicatesYes when="$when" yes
106 run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
110 @########################################
111 @# The second job will kill the first one
112 @########################################
113 run comment="Should fail" level=Full job=CancelRunningDuplicatesYes yes
115 run comment="Should work" level=Full job=CancelRunningDuplicatesYes yes
119 @##########################
120 @# The second job won't run
121 @##########################
122 run comment="Should work" level=Full job=CancelRunningDuplicatesNo yes
124 run comment="Should fail" level=Full job=CancelRunningDuplicatesNo yes
129 SELECT JobId, Name, Level, Comment, JobStatus from Job
130 WHERE Comment='Should fail' and JobStatus='T' ORDER By JobId;
134 SELECT JobId, Name, Level, Comment, JobStatus from Job
135 WHERE Comment='Should work' and JobStatus != 'T' ORDER By JobId;
139 SELECT JobId, Name, Level, Comment, JobStatus from Job order by JobId;
145 check_for_zombie_jobs storage=File
151 grep '^| [0-9]' $tmp/log7.out > /dev/null
153 print_debug "E: Found errors in $tmp/log7.out"
154 print_debug `cat $tmp/log7.out`
158 grep '^| [0-9]' $tmp/log8.out > /dev/null
160 print_debug "E: Found errors in $tmp/log8.out"
161 print_debug `cat $tmp/log8.out`