From: Michal Rakowski Date: Wed, 9 Jun 2021 06:23:50 +0000 (+0200) Subject: regress: Add tests for copy/migration job error handling X-Git-Tag: Release-11.3.2~494 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de715242262a60421ea18c710a836d436dfe0644;p=thirdparty%2Fbacula.git regress: Add tests for copy/migration job error handling --- diff --git a/regress/tests/copy-job-error-test b/regress/tests/copy-job-error-test new file mode 100755 index 000000000..eedab584a --- /dev/null +++ b/regress/tests/copy-job-error-test @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# TODO fill desc +# +TestName="copy-job-error-test" +JobName=CopyJobSave +. scripts/functions + + +scripts/cleanup +scripts/copy-migration-confs +echo "${cwd}/build" >${cwd}/tmp/file-list +sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1 +sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf +change_jobname NightlySave $JobName + +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "SD Connect Timeout", "1", "Director")' + +start_test + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +run job=$JobName yes +wait +list jobs +messages +quit +END_OF_DATA + +run_bacula + +pkill bacula-sd + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log2.out +run job=copy-job yes +wait +list jobs +messages +quit +END_OF_DATA + +run_bconsole + +grep "Copying Error" $tmp/log2.out > /dev/null +if [ $? -ne 0 ]; then + print_debug "ERROR: should find Migration Error in $tmp/log2.out" + estat=1 +fi + +stop_bacula + +end_test diff --git a/regress/tests/migration-job-error-test b/regress/tests/migration-job-error-test new file mode 100755 index 000000000..5d02dabee --- /dev/null +++ b/regress/tests/migration-job-error-test @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# TODO fill desc +# + +TestName="migration-job-error-test" +JobName=MigrationJobSave +. scripts/functions + + +scripts/cleanup +scripts/copy-migration-confs +echo "${cwd}/build" >${cwd}/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "SD Connect Timeout", "1", "Director")' + + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +run job=$JobName yes +wait +list jobs +quit +END_OF_DATA + +run_bacula + +pkill bacula-sd +if [ $? -ne 0 ]; then + print_debug "ERROR: Failed to kill SD!" + estat=1 +fi + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log2.out +run job=migrate-job yes +wait +list jobs +messages +quit +END_OF_DATA + +run_bconsole + +grep "Migration Error" $tmp/log2.out > /dev/null +if [ $? -ne 0 ]; then + print_debug "ERROR: should find Migration Error in $tmp/log2.out" + estat=1 +fi +#stop_bacula + +end_test