]> git.sur5r.net Git - bacula/bacula/commitdiff
regress: Add delete-test to reproduce #1643
authorEric Bollengier <eric@eb.homelinux.org>
Wed, 13 Oct 2010 09:14:16 +0000 (11:14 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Wed, 13 Oct 2010 18:05:41 +0000 (20:05 +0200)
regress/tests/delete-test [new file with mode: 0755]

diff --git a/regress/tests/delete-test b/regress/tests/delete-test
new file mode 100755 (executable)
index 0000000..67e9aa6
--- /dev/null
@@ -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 <<EOF > ${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