From: Eric Bollengier Date: Fri, 17 Mar 2023 12:59:27 +0000 (+0100) Subject: regress: check prune, purge and delete. X-Git-Tag: Release-13.0.3~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9847751924433f2c16410d57c5ee4f0c0d749b9f;p=thirdparty%2Fbacula.git regress: check prune, purge and delete. --- diff --git a/regress/tests/console-acl-test b/regress/tests/console-acl-test index 5804f6cee..617fe421f 100755 --- a/regress/tests/console-acl-test +++ b/regress/tests/console-acl-test @@ -27,6 +27,10 @@ echo "$cwd/build/po" > $tmp/file-list export JobName HOST tmp conf change_jobname NightlySave $JobName +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "Autoprune", "no", "Director")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "File Retention", "2s", "Client")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "File Retention", "2s", "Pool")' + $rscripts/setup_rconsole start_test @@ -963,16 +967,177 @@ EOF $bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds ################################################################ - +# Check prune, purge, delete commands fn=$tmp/cmd1.out +cat < $tmp/bconcmds +@############################################## +@$out $fn-before +list jobs +@output $fn-before +list files jobid=1 +quit +EOF + +$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds + cat < $tmp/bconcmds @############################################## @$out $fn list jobid=1 - purge files jobid=1 yes +quit +EOF + +$bin/bconsole -c $tmp/bconsole.conf.job < $tmp/bconcmds + +fn=$tmp/cmd1.out +cat < $tmp/bconcmds +@############################################## +@$out $fn-after +list jobid=1 +@output $fn-after +list files jobid=1 +quit +EOF + +$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds + +# Check if the job was here +if ! grep Simple $fn-before > /dev/null; then + print_debug "ERROR: Should find the job Simple in $fn-before" + estat=1 +fi + +# Check if the files was here +if ! grep uk.po $fn-before > /dev/null; then + print_debug "ERROR: Should find the files in $fn-before" + estat=1 +fi + +# Check if the job is still here +if ! grep Simple $fn-after > /dev/null; then + print_debug "ERROR: Should find the job Simple in $fn-after" + estat=1 +fi + +# Check if the files are still here +if ! grep uk.po $fn-after > /dev/null; then + print_debug "ERROR: Should find the files in $fn-after" + estat=1 +fi + +################ +fn=$tmp/cmd2.out +cat < $tmp/bconcmds +@############################################## +@$out $fn +list jobid=1 purge jobs jobid=1 yes +quit +EOF + +$bin/bconsole -c $tmp/bconsole.conf.job < $tmp/bconcmds + +cat < $tmp/bconcmds +@############################################## +@$out $fn-after +list jobid=1 +@output $fn-after +list files jobid=1 +quit +EOF + +$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds + +# Check if the job is still here +if ! grep Simple $fn-after > /dev/null; then + print_debug "ERROR: Should find the job Simple in $fn-after" + estat=1 +fi + +# Check if the files are still here +if ! grep uk.po $fn-after > /dev/null; then + print_debug "ERROR: Should find the files in $fn-after" + estat=1 +fi + +################ +fn=$tmp/cmd3.out +cat < $tmp/bconcmds +@############################################## +@$out $fn +list jobid=1 delete jobid=1 yes +quit +EOF + +$bin/bconsole -c $tmp/bconsole.conf.job < $tmp/bconcmds + +cat < $tmp/bconcmds +@############################################## +@$out $fn-after +list jobid=1 +@output $fn-after +list files jobid=1 +quit +EOF + +$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds + +# Check if the job is still here +if ! grep Simple $fn-after > /dev/null; then + print_debug "ERROR: Should find the job Simple in $fn-after" + estat=1 +fi + +# Check if the files are still here +if ! grep uk.po $fn-after > /dev/null; then + print_debug "ERROR: Should find the files in $fn-after" + estat=1 +fi + +################ +fn=$tmp/cmd4.out +cat < $tmp/bconcmds +@############################################## +@$out $fn +list jobid=1 +prune volume=TestVolume001 yes +prune volume=TestVolume002 yes +quit +EOF + +$bin/bconsole -c $tmp/bconsole.conf.job < $tmp/bconcmds + +cat < $tmp/bconcmds +@############################################## +@$out $fn-after +list jobid=1 +@output $fn-after +list files jobid=1 +quit +EOF + +$bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds + +# Check if the job is still here +if ! grep Simple $fn-after > /dev/null; then + print_debug "ERROR: Should find the job Simple in $fn-after" + estat=1 +fi + +# Check if the files are still here +if ! grep uk.po $fn-after > /dev/null; then + print_debug "ERROR: Should find the files in $fn-after" + estat=1 +fi + +################ +fn=$tmp/cmd5.out +cat < $tmp/bconcmds +@############################################## +@$out $fn +list jobid=1 purge volume=TestVolume001 yes purge volume=TestVolume002 yes quit @@ -982,8 +1147,9 @@ $bin/bconsole -c $tmp/bconsole.conf.job < $tmp/bconcmds cat < $tmp/bconcmds @############################################## -@output $fn +@$out $fn-after list jobid=1 +@output $fn-after list files jobid=1 quit EOF @@ -991,14 +1157,14 @@ EOF $bin/bconsole -c $conf/bconsole.conf.old < $tmp/bconcmds # Check if the job is still here -if ! grep Simple $fn > /dev/null; then - print_debug "ERROR: Should find the job Simple in $fn" +if ! grep Simple $fn-after > /dev/null; then + print_debug "ERROR: Should find the job Simple in $fn-after" estat=1 fi # Check if the files are still here -if ! grep uk.po $fn > /dev/null; then - print_debug "ERROR: Should find the files in $fn" +if ! grep uk.po $fn-after > /dev/null; then + print_debug "ERROR: Should find the files in $fn-after" estat=1 fi