From: Eric Bollengier Date: Fri, 17 Mar 2023 16:50:30 +0000 (+0100) Subject: regess: Add test with cancel on restricted console X-Git-Tag: Release-13.0.3~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b14da871c5210c77cb6045aeee72199da3b8a11;p=thirdparty%2Fbacula.git regess: Add test with cancel on restricted console --- diff --git a/regress/scripts/new-test-bacula-dir.conf.in b/regress/scripts/new-test-bacula-dir.conf.in index 38fea4762..9e323a292 100644 --- a/regress/scripts/new-test-bacula-dir.conf.in +++ b/regress/scripts/new-test-bacula-dir.conf.in @@ -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" diff --git a/regress/tests/console-acl-test b/regress/tests/console-acl-test index 617fe421f..7950c3f7f 100755 --- a/regress/tests/console-acl-test +++ b/regress/tests/console-acl-test @@ -1168,5 +1168,57 @@ if ! grep uk.po $fn-after > /dev/null; then estat=1 fi +################ +fn=$tmp/cmd6.out +cat < $tmp/bconcmds +@############################################## +@$out $fn +run job=Slow yes +run job=Slow yes +quit +EOF + +$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds + +cat < $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 < $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