From: Eric Bollengier Date: Wed, 13 Oct 2010 09:14:16 +0000 (+0200) Subject: regress: Add delete-test to reproduce #1643 X-Git-Tag: Release-5.2.1~1024 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f8dc4cc7f8720dcdd3e365712d3fe0376dd1be3b;p=bacula%2Fbacula regress: Add delete-test to reproduce #1643 --- diff --git a/regress/tests/delete-test b/regress/tests/delete-test new file mode 100755 index 0000000000..67e9aa6847 --- /dev/null +++ b/regress/tests/delete-test @@ -0,0 +1,70 @@ +#!/bin/sh +# +# This script will test object deletion +# +. scripts/functions + +TestName="delete-test" +JobName=NightlySave + +scripts/cleanup +scripts/copy-test-confs + +start_test + +echo $PWD/build/po > tmp/file-list + +cat < ${cwd}/tmp/bconcmds +@$out /dev/null +messages +@$out $tmp/log1.out +label storage=File volume=TestVolume001 +run job=$JobName level=full yes +wait +messages +@exec "touch $cwd/build/po/fr.po" +run job=$JobName level=incremental yes +wait +messages +@exec "touch $cwd/build/po/de.po" +run job=$JobName level=incremental yes +wait +messages +@out $tmp/log2.out +delete jobid=3 +sql +SELECT 'FOUND 1' FROM File WHERE JobId=3; +SELECT 'FOUND 2' FROM JobMedia WHERE JobId=3; +SELECT 'FOUND 3' FROM Log WHERE JobId=3; +SELECT 'FOUND 4' FROM BaseFiles WHERE JobId=3; + +@out $tmp/log3.out +delete volume=TestVolume001 yes +sql +SELECT 'FOUND 1' FROM File WHERE JobId IN (1,2); +SELECT 'FOUND 2' FROM JobMedia WHERE JobId IN (1,2); +SELECT 'FOUND 3' FROM Log WHERE JobId IN (1,2); +SELECT 'FOUND 4' FROM BaseFiles WHERE JobId IN (1,2); + +quit +EOF + +run_bacula + +check_two_logs + +estat=0 + +grep -v SELECT $tmp/log2.out | grep FOUND > /dev/null +if [ $? = 0 ]; then + print_debug "Found orphan records in $tmp/log2.out" + estat=1 +fi + +grep -v SELECT $tmp/log3.out | grep FOUND > /dev/null +if [ $? = 0 ]; then + print_debug "Found orphan records in $tmp/log3.out" + estat=1 +fi + +end_test