From bd525095627b1a9c8cb955aa4c7c3d330c973fde Mon Sep 17 00:00:00 2001 From: Michal Rakowski Date: Tue, 10 Aug 2021 12:51:32 +0200 Subject: [PATCH] regress: add test for #7998 About client initiated backup crash --- regress/tests/remote-console-duplicate-test | 121 ++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100755 regress/tests/remote-console-duplicate-test diff --git a/regress/tests/remote-console-duplicate-test b/regress/tests/remote-console-duplicate-test new file mode 100755 index 000000000..dcf738847 --- /dev/null +++ b/regress/tests/remote-console-duplicate-test @@ -0,0 +1,121 @@ +#!/bin/bash +# +# Copyright (C) 2000-2021 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Test and setup the Client Initiated Backup from Job Duplicates +# Tests for bug #7998 +# +TestName="remote-console-duplicate-test" +JobName=backup +. scripts/functions + +scripts/cleanup +scripts/copy-confs + +if [ x$FORCE_TLS != xyes ]; then + # The certificate must match the address + $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Address", "0.0.0.0", "Client")' +fi +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaximumBandwidthPerJob", "1mb/s", "Client")' +$bperl -e 'extract_resource("$conf/bconsole.conf", "Director")' | sed 's/Director/Console/' > $tmp/1 +cat $tmp/1 >> $conf/bacula-fd.conf +pass=`grep -i password $tmp/1` +name=`grep -i name $tmp/1` + +#run_bacula + +cat <> $conf/bacula-dir.conf +Console { + $name + $pass + CommandAcl = run, .api, restore, wait, status, .status, .jobs, .clients, .storages, .pools, .filesets, .defaults + jobacl = *all* + poolacl = *all* + clientacl = *all* + storageacl = *all* + catalogacl = *all* + filesetacl = *all* + directoryacl = *all* + useridacl = *all* + whereacl = *all* +} +EOF + +cat <> $conf/bacula-fd.conf +Director { + Name = remote-cons + Password = "oi3deith3peeGho4" + Remote = yes +} +EOF + +FDPORT=`expr $BASEPORT + 1` + +cat < $tmp/bconsole-remote.conf +Director { + Name = remote-cons + DIRport = $FDPORT + address = localhost + Password = "noused" +} + +Console { + Name = remote-cons + Director = remote-cons + Password = "oi3deith3peeGho4" +} +EOF + +change_jobname BackupClient1 $JobName +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'AllowDuplicateJobs', 'no', 'Job', '$JobName')" +start_test + +if [ x$FORCE_TLS = xyes ]; then + $bperl -e "setup_cons_tls('$tmp/bconsole-remote.conf')" +fi + +cat <$tmp/bconcmds +@$out /dev/null +messages +@$out $tmp/log1.out +label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0 +quit +END_OF_DATA + +run_bacula + +echo -e "proxy\nrun job=backup fdcalled=1 level=full yes" | $bin/bconsole -c $tmp/bconsole-remote.conf +echo -e "proxy\nrun job=backup fdcalled=1 level=full yes" | $bin/bconsole -c $tmp/bconsole-remote.conf + +cat <$tmp/bconcmds +@$out $tmp/log1.out +list jobs +wait +messages +@$out $tmp/log2.out +list joblog jobid=1 +@$out $tmp/log3.out +list joblog jobid=2 +END_OF_DATA + +run_bconsole + +n_ok=`cat $tmp/log2.out| grep 'Termination:' | grep 'Backup OK' | wc -l` +n_canceled=`cat $tmp/log3.out| grep 'Termination:' | grep 'Backup Canceled' | wc -l` + +if [ ${n_ok} -ne 1 ]; then + estat=1 + print_debug "ERROR: JobId 1 did not succeded, see ${tmp}/log2.out!" +fi + +if [ ${n_canceled} -ne 1 ]; then + estat=1 + print_debug "ERROR: JobId 2 was not canceled, see ${tmp}/log3.out!" +fi + +check_for_zombie_jobs storage=File1 + +stop_bacula + +end_test -- 2.47.3