]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regess: Add test with cancel on restricted console
authorEric Bollengier <eric@baculasystems.com>
Fri, 17 Mar 2023 16:50:30 +0000 (17:50 +0100)
committerEric Bollengier <eric@baculasystems.com>
Tue, 2 May 2023 07:07:18 +0000 (09:07 +0200)
regress/scripts/new-test-bacula-dir.conf.in
regress/tests/console-acl-test

index 38fea476201767eac4478ebfd19d37a3283ebdbb..9e323a292236e9a70010bcb417101f7e921ef007 100644 (file)
@@ -77,6 +77,21 @@ Job {
 # SpoolData=yes
 }
 
+Job {
+  Name = "Slow"
+  Type = Backup
+  Client=@hostname@-fd 
+  FileSet="SimpleSet"
+  Storage = File
+  Messages = Standard
+  Pool = Default
+  Maximum Concurrent Jobs = 10
+  Write Bootstrap = "@working_dir@/NightlySave.bsr"
+  Max Run Time = 30min
+  RunBeforeJob = "sleep 5"
+# SpoolData=yes
+}
+
 
 Job {
   Name = "MonsterSave"
index 617fe421fa6ad24eee312866fbdfbf9c266bac2d..7950c3f7fbfd7188473d1b6c5d72f6eed0b793da 100755 (executable)
@@ -1168,5 +1168,57 @@ if ! grep uk.po $fn-after > /dev/null; then
     estat=1
 fi
 
+################
+fn=$tmp/cmd6.out
+cat <<EOF > $tmp/bconcmds
+@##############################################
+@$out $fn
+run job=Slow yes
+run job=Slow yes
+quit
+EOF
+
+$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds
+
+cat <<EOF > $tmp/bconcmds
+@##############################################
+@$out $fn-after
+cancel jobid=10 yes
+cancel all yes
+cancel
+1
+yes
+quit
+EOF
+
+$bin/bconsole -c $tmp/bconsole.conf.job < $tmp/bconcmds
+
+cat <<EOF > $tmp/bconcmds
+@##############################################
+@$out $fn
+wait
+messages
+quit
+EOF
+
+$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds
+
+if ! grep "None of your jobs are running" $fn-after > /dev/null; then
+    print_debug "ERROR: Should not be able to see jobs in $fn-after"
+    estat=1
+fi
+
+if ! grep "Unauthorized command from this console for JobId=10" $fn-after > /dev/null; then
+    print_debug "ERROR: Should find Unauthorized message in $fn-after"
+    estat=1
+fi
+
+nb=`grep "Backup OK" $fn | wc -l`
+
+if [ $nb -ne 2 ]; then
+    print_debug "ERROR: Should not find canceled jobs in $fn"
+    estat=1
+fi
+
 stop_bacula
 end_test