#!/bin/sh
#
+# Note. This test does not work correctly in 5.0, because we do not
+# have the Job "Comment" field. Update this test when updating
+# to the next database version.
#
TestName="duplicate-job-test"
. scripts/functions
@##############################################
@# AllowDuplicates = Yes, both jobs should work
@##############################################
-run comment="Should work" level=Full job=AllowDuplicateYes yes
+run level=Full job=AllowDuplicateYes yes
@sleep 2
-run comment="Should work" level=Full job=AllowDuplicateYes yes
+run level=Full job=AllowDuplicateYes yes
wait
messages
@$out $tmp/log3.out
@###############################################################
@# Run two jobs with the same level and see wich one is canceled
@###############################################################
-run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
+run level=Full job=CancelLowerLevelDuplicatesYes yes
@sleep 2
-run comment="Should fail" level=Full job=CancelLowerLevelDuplicatesYes yes
+run level=Full job=CancelLowerLevelDuplicatesYes yes
wait
messages
@####################################################################
@# Run two jobs with the different level and see wich one is canceled
@####################################################################
-run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
+run level=Incremental job=CancelLowerLevelDuplicatesYes yes
@sleep 2
-run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
+run level=Full job=CancelLowerLevelDuplicatesYes yes
wait
messages
-run comment="Should fail" level=Differential job=CancelLowerLevelDuplicatesYes yes
+run level=Differential job=CancelLowerLevelDuplicatesYes yes
@sleep 2
-run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
+run level=Full job=CancelLowerLevelDuplicatesYes yes
wait
messages
-run comment="Should work" level=Differential job=CancelLowerLevelDuplicatesYes yes
+run level=Differential job=CancelLowerLevelDuplicatesYes yes
@sleep 2
-run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
+run level=Incremental job=CancelLowerLevelDuplicatesYes yes
wait
messages
@#####################################################################################
@# Run two jobs with the different level and see wich one is canceled (reversed order)
@#####################################################################################
-run comment="Should work" level=Full job=CancelLowerLevelDuplicatesYes yes
+run level=Full job=CancelLowerLevelDuplicatesYes yes
@sleep 2
-run comment="Should fail" level=Incremental job=CancelLowerLevelDuplicatesYes yes
+run level=Incremental job=CancelLowerLevelDuplicatesYes yes
wait
messages
@$out $tmp/log4.out
@####################################################################
@# Run two jobs, the second one can't cancel the 1st, and should fail
@####################################################################
-run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
+run level=Full job=CancelQueueDuplicatesYes yes
@sleep 2
-run comment="Should fail" level=Full job=CancelQueueDuplicatesYes yes
+run level=Full job=CancelQueueDuplicatesYes yes
wait
messages
@#################################################################
@# The first job should stay queued, the second one will cancel it
@#################################################################
-run comment="Should fail" level=Full job=CancelQueueDuplicatesYes when="$when" yes
+run level=Full job=CancelQueueDuplicatesYes when="$when" yes
@sleep 2
-run comment="Should work" level=Full job=CancelQueueDuplicatesYes yes
+run level=Full job=CancelQueueDuplicatesYes yes
wait
messages
@$out $tmp/log5.out
@########################################
@# The second job will kill the first one
@########################################
-run comment="Should fail" level=Full job=CancelRunningDuplicatesYes yes
+run level=Full job=CancelRunningDuplicatesYes yes
@sleep 2
-run comment="Should work" level=Full job=CancelRunningDuplicatesYes yes
+run level=Full job=CancelRunningDuplicatesYes yes
wait
messages
@$out $tmp/log6.out
@##########################
@# The second job won't run
@##########################
-run comment="Should work" level=Full job=CancelRunningDuplicatesNo yes
+run level=Full job=CancelRunningDuplicatesNo yes
@sleep 2
-run comment="Should fail" level=Full job=CancelRunningDuplicatesNo yes
+run level=Full job=CancelRunningDuplicatesNo yes
wait
messages
@$out $tmp/log7.out
sql
-SELECT JobId, Name, Level, Comment, JobStatus from Job
-WHERE Comment='Should fail' and JobStatus='T' ORDER By JobId;
+SELECT JobId, Name, Level, JobStatus from Job
+WHERE JobStatus='T' ORDER By JobId;
@$out $tmp/log8.out
sql
-SELECT JobId, Name, Level, Comment, JobStatus from Job
-WHERE Comment='Should work' and JobStatus != 'T' ORDER By JobId;
+SELECT JobId, Name, Level, JobStatus from Job
+WHERE JobStatus != 'T' ORDER By JobId;
@$out $tmp/log9.out
sql
-SELECT JobId, Name, Level, Comment, JobStatus from Job order by JobId;
+SELECT JobId, Name, Level, JobStatus from Job order by JobId;
quit
END_OF_DATA
touch $tmp/log2.out
check_two_logs
-grep '^| *[0-9]' $tmp/log7.out > /dev/null
-if [ $? = 0 ]; then
- print_debug "ERROR: Found errors in $tmp/log7.out"
- print_debug `cat $tmp/log7.out`
- estat=1
-fi
-
-grep '^| *[0-9]' $tmp/log8.out > /dev/null
-if [ $? = 0 ]; then
- print_debug "ERROR: Found errors in $tmp/log8.out"
- print_debug `cat $tmp/log8.out`
- estat=1
-fi
-
-nb=`grep '^| *[0-9]' $tmp/log9.out | wc -l`
-if [ $nb -lt 10 ]; then
- print_debug "ERROR: no enough results in $tmp/log9.out"
- print_debug `cat $tmp/log9.out`
- estat=1
-fi
+#
+# Note, without the comment field, these do not work.
+#
+#grep '^| *[0-9]' $tmp/log7.out > /dev/null
+#if [ $? = 0 ]; then
+# print_debug "ERROR: Found errors in $tmp/log7.out"
+# print_debug `cat $tmp/log7.out`
+# estat=1
+#fi
+
+#grep '^| *[0-9]' $tmp/log8.out > /dev/null
+#if [ $? = 0 ]; then
+# print_debug "ERROR: Found errors in $tmp/log8.out"
+# print_debug `cat $tmp/log8.out`
+# estat=1
+#fi
+
+#nb=`grep '^| *[0-9]' $tmp/log9.out | wc -l`
+#if [ $nb -lt 10 ]; then
+# print_debug "ERROR: Insufficient Jobs in $tmp/log9.out"
+# print_debug `cat $tmp/log9.out`
+# estat=1
+#fi
end_test