From: Michal Rakowski Date: Fri, 23 Apr 2021 12:41:36 +0000 (+0200) Subject: regress: Add test for #7552 about copying wrong job X-Git-Tag: Release-11.3.2~559 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b17462d6bcb6d5741e153c25ce18719c54977909;p=thirdparty%2Fbacula.git regress: Add test for #7552 about copying wrong job --- diff --git a/regress/tests/copy-twin-test b/regress/tests/copy-twin-test new file mode 100755 index 000000000..259845dd1 --- /dev/null +++ b/regress/tests/copy-twin-test @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (C) 2000-2021 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Tests for #7552 +# +# Run backup job, change its type to copy, reload configuration and run same job once more. +# Second job should not be started at all. +# +TestName="copy-twin-test" +JobName=copy-twin-test +. 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 +rm -f ${cwd}/build/po/test.po >/dev/null + +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Type", "Backup", "Job", "copy-uncopied")' + +start_test + +# Run job with type=backup +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +wait +messages +run job=copy-uncopied yes +wait +messages +quit +END_OF_DATA + +run_bacula + +# Change job's type to copy, reload configuration and run job once more +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Type", "Copy", "Job", "copy-uncopied")' + +cat <${cwd}/tmp/bconcmds +reload +@$out ${cwd}/tmp/log2.out +run job=copy-uncopied yes +wait +messages +quit +END_OF_DATA + +run_bconsole + +n_msg=`cat ${cwd}/tmp/log2.out | grep "Unexpected type ('c') of job to copy:" | wc -l` +n_err=`cat ${cwd}/tmp/log2.out | grep 'Copying Error' | wc -l` + +if [ ${n_msg} -ne 1 ]; then + estat=1 + print_debug "Wrong count of error message regarding already existing job: ${n_msg}, expected 1" +fi + +if [ ${n_msg} -ne 1 ]; then + estat=1 + print_debug "Wrong count of 'Copying Error' message: ${n_err}, expected 1" +fi + +stop_bacula +end_test