]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: update runscript-test for cancel status
authorEric Bollengier <eric@baculasystems.com>
Mon, 13 Feb 2023 19:17:49 +0000 (20:17 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
regress/scripts/bacula-dir.conf.testrunscript.in
regress/tests/runscript-test

index b0fecdfc80434dfb946882992f3b432bb13e8d8f..db3af9f4fe62ef72ddfca115119fe4784aa17818 100644 (file)
@@ -274,6 +274,24 @@ Job {
   }
 }
 
+Job {
+  Name = "RUN_WAITQ_EXIT"
+  FileSet = FS_TESTJOB  
+  JobDefs = DefaultJob
+  Maximum Concurrent Jobs = 10
+  RunScript {
+    RunsWhen = Queued
+    Command = "@tmpdir@/exit.sh"
+    failjobonerror = no
+    runsonclient = no
+  }
+  RunScript {
+    RunsWhen = After
+    Command = "sleep 15"
+    runsonclient = yes
+  }
+}
+
 Job { 
   Name = "Restore" 
   Type = Restore 
index 68b48c0e202feb5d13986ece1cacf5c7da0e642c..a75e79f89259afdaa5cdf0700e21952df6e8b579 100755 (executable)
@@ -41,6 +41,13 @@ EOF
 
 chmod +x $tmp/asleep.sh
 
+cat <<EOF > $tmp/exit.sh
+#!/bin/sh
+exit 2
+EOF
+
+chmod +x $tmp/exit.sh
+
 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @output /dev/null
 messages
@@ -105,6 +112,11 @@ messages
 .jlist jobid=8
 .jlist jobid=9
 .jlist jobid=10
+@$out $tmp/RUN_WAITQ_EXIT.log
+run job=RUN_WAITQ_EXIT yes
+wait
+messages
+.jlist jobid=11
 quit
 END_OF_DATA
 
@@ -244,4 +256,13 @@ if [ $? -ne 0 ]; then
     estat=1
 fi
 
+grep '{' $tmp/RUN_WAITQ_EXIT.log | perl -MJSON -e '
+$j1 = decode_json(<>);
+exit ($j1->{data}->[0]->{jobstatus} eq "A");
+'
+if [ $? -ne 1 ]; then
+    print_debug "ERROR: Incorrect job status reported in $tmp/RUN_WAITQ_EXIT.log"
+    estat=1
+fi
+
 end_test