From: Eric Bollengier Date: Mon, 2 Feb 2026 07:52:53 +0000 (+0100) Subject: regress: Add test delete-volume-test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=577dbeefad4aca45f9c1c8cb8e0089c9e189a1a1;p=thirdparty%2Fbacula.git regress: Add test delete-volume-test --- diff --git a/regress/tests/delete-volume-test b/regress/tests/delete-volume-test new file mode 100755 index 000000000..8bc4f7eeb --- /dev/null +++ b/regress/tests/delete-volume-test @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Copyright (C) 2000-2021 Kern Sibbald +# Copyright (C) 2021-2025 Bacula Systems SA +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# This script will test volume deletion +# +. scripts/functions + +TestName="delete-volume-test" +JobName=NightlySave + +scripts/cleanup +scripts/copy-test-confs + +start_test + +echo $PWD/build/po > tmp/file-list + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'MaximumVolumeJobs', '10', 'Pool')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'LabelFormat', 'Vol', 'Pool')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SpoolData', 'no', 'Job')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Autoprune', 'no', 'Director')" + +cat <> $conf/bacula-dir.conf +Pool { + Name = Test1 + Pool Type = Backup + LabelFormat = Vol + VolumeRetention = 1d + MaximumVolumeJobs = 10 + MaximumVolumeBytes = 1MB +} +EOF + +cat < ${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +run job=$JobName level=full pool=Test1 yes +wait +messages +@output $tmp/1.out +.jlist pool=Test1 +@output $tmp/2.out +.jlist volumes pool=Test1 +@$out $tmp/log1.out +delete volume=Vol0001 yes +@output $tmp/3.out +.jlist pool=Test1 +quit +EOF + +run_bacula +stop_bacula + +grep '{' $tmp/1.out | perl -MJSON -e '$obj = decode_json(<>); exit $obj->{data}->[0]->{numvols};' +nb1=$? + +grep '{' $tmp/3.out | perl -MJSON -e '$obj = decode_json(<>); exit $obj->{data}->[0]->{numvols};' +nb2=$? + +nb3=`expr $nb2 + 1` + +if [ $nb3 != $nb1 ]; then + print_debug "ERROR: Should find one volume less in $tmp/3.out (nb1=$nb1 nb2=$nb2)" + estat=1 +fi + +end_test