From: Michal Rakowski Date: Mon, 24 Jan 2022 21:40:03 +0000 (+0100) Subject: regress: add runscript-job-status-test X-Git-Tag: Beta-15.0.0~665 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=750207d803fd923079329e3d6d7fdab0e8f0da03;p=thirdparty%2Fbacula.git regress: add runscript-job-status-test --- diff --git a/regress/tests/runscript-job-status-test b/regress/tests/runscript-job-status-test new file mode 100755 index 000000000..45d9d0b66 --- /dev/null +++ b/regress/tests/runscript-job-status-test @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Copyright (C) 2000-2021 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Test if itermediate Job statuses are reported for Before and After Job Runscripts. +# +. scripts/functions + +TestName="runscript-job-status-test" +JobName=backup + +scripts/cleanup +scripts/copy-confs + +# +# Zap out any schedule in default conf file so that +# it doesn't start during our test +# +outf="$tmp/sed_tmp" +echo "s% Schedule =%# Schedule =%g" >${outf} +cp $scripts/bacula-dir.conf $tmp/1 +sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf + +cat <> $bin/bacula-dir.conf +Job { + Name = "backup_after" + FileSet = "Full Set" + JobDefs = DefaultJob + RunScript { + Command = "/bin/sleep 10" + RunsWhen = After + RunsOnClient = no + #FailJobOnError = no + } +} + +Job { + Name = "backup_before" + FileSet = "Full Set" + JobDefs = DefaultJob + RunScript { + Command = "/bin/sleep 10" + RunsWhen = Before + RunsOnClient = no + #FailJobOnError = no + } +} +END_OF_DATA + +start_test + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/RUN_ALL_OK.log +label volume=TestVolume001 storage=File2 pool=File slot=1 drive=0 +run job=backup_before yes +@sleep 5 +@$out ${cwd}/tmp/status_before.log +status dir +@$out ${cwd}/tmp/backup_before.log +wait +messages +run job=backup_after yes +@sleep 10 +@$out ${cwd}/tmp/status_after.log +status dir +@$out ${cwd}/tmp/backup_after.log +wait +messages +quit +END_OF_DATA + +run_bacula + +status=`cat $tmp/status_before.log | grep 'executing Before Job Scripts'` +if [ "$status" = "" ]; then + print_debug "Did not found information about the BeforeJob script, see $tmp/status_before.log" + estat=1 +fi + +status=`cat $tmp/status_after.log | grep 'executing After Job Scripts'` +if [ "$status" = "" ]; then + print_debug "Did not found information about the AfterJob script, see $tmp/status_after.log" + estat=1 +fi + +stop_bacula + +end_test