From: Eric Bollengier Date: Wed, 23 Mar 2022 14:45:20 +0000 (+0100) Subject: regress: Add test prune-expired-test X-Git-Tag: Release-11.3.2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93c38235ba193ed3229480c37ec5d79c1b1587e3;p=thirdparty%2Fbacula.git regress: Add test prune-expired-test --- diff --git a/regress/tests/prune-expired-test b/regress/tests/prune-expired-test new file mode 100755 index 000000000..fc44d544c --- /dev/null +++ b/regress/tests/prune-expired-test @@ -0,0 +1,111 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# This script will test prune algo on expired volumes +# +. scripts/functions + +TestName="prune-expired-test" +JobName=NightlySave + +scripts/cleanup +scripts/copy-test-confs + +setup_shstore # simulate shared storage if enabled + +start_test + +echo $PWD/build/po > tmp/file-list + +# We want to have pruning only when doing prune command +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "No", "Client")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Volume Retention", "5s", "Pool")' + +cat < ${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +label storage=File volume=TestVolume001 +label storage=File volume=TestVolume002 +run job=$JobName level=full yes +wait +@exec "touch $cwd/build/po/fr.po" +run job=$JobName level=incremental yes +wait +@$out $tmp/log2.out +@############################### +@# Will prune nothing +prune volume expired yes +list volume +@############################### +@# Back to log1 +@$out $tmp/log1.out +update volume=TestVolume001 volstatus=Used +run job=$JobName level=full yes +wait +@exec "touch $cwd/build/po/fr.po" +run job=$JobName level=incremental yes +wait +messages +@sleep 6 +@$out $tmp/log3.out +@############################### +@# will prune TestVolume001 +prune volume expired yes +list volume +update volume=TestVolume002 volstatus=Used +@$out $tmp/log4.out +@############################### +@# will prune nothing +prune volume expired +no +list volume +@$out $tmp/log5.out +@############################### +@# will prune TestVolume002 +prune volume expired +yes +list volume +quit +EOF + +run_bacula + +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs + +grep 'TestVolume001.*Append' $tmp/log2.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: Should not prune TestVolume001 in $tmp/log2.out" + estat=1 +fi + +grep 'TestVolume002.*Append' $tmp/log2.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: Should not prune TestVolume002 in $tmp/log2.out" + estat=1 +fi + +grep 'There are no more Jobs associated with Volume "TestVolume001"' $tmp/log3.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: Should prune TestVolume001 in $tmp/log3.out" + estat=1 +fi + +grep 'TestVolume002.*Used' $tmp/log4.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: Should not TestVolume002 in $tmp/log4.out" + estat=1 +fi + +grep 'There are no more Jobs associated with Volume "TestVolume002"' $tmp/log5.out > /dev/null +if [ $? != 0 ]; then + print_debug "ERROR: Should prune TestVolume002 in $tmp/log5.out" + estat=1 +fi + +end_test