]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/delete-test
Tweak restart base
[bacula/bacula] / regress / tests / delete-test
1 #!/bin/sh
2 #
3 # This script will test object deletion
4 #
5 . scripts/functions
6
7 TestName="delete-test"
8 JobName=NightlySave
9
10 scripts/cleanup
11 scripts/copy-test-confs
12
13 start_test
14
15 echo $PWD/build/po > tmp/file-list
16
17 cat <<EOF > ${cwd}/tmp/bconcmds
18 @$out /dev/null
19 messages
20 @$out $tmp/log1.out
21 label storage=File volume=TestVolume001
22 run job=$JobName level=full yes
23 wait
24 messages
25 @exec "touch $cwd/build/po/fr.po"
26 run job=$JobName level=incremental yes
27 wait
28 messages
29 @exec "touch $cwd/build/po/de.po"
30 run job=$JobName level=incremental yes
31 wait
32 messages
33 @out $tmp/log2.out
34 delete jobid=3
35 sql
36 SELECT 'FOUND 1' FROM File WHERE JobId=3;
37 SELECT 'FOUND 2' FROM JobMedia WHERE JobId=3;
38 SELECT 'FOUND 3' FROM Log WHERE JobId=3;
39 SELECT 'FOUND 4' FROM BaseFiles WHERE JobId=3;
40
41 @out $tmp/log3.out
42 delete volume=TestVolume001 yes
43 sql
44 SELECT 'FOUND 1' FROM File WHERE JobId IN (1,2);
45 SELECT 'FOUND 2' FROM JobMedia WHERE JobId IN (1,2);
46 SELECT 'FOUND 3' FROM Log WHERE JobId IN (1,2);
47 SELECT 'FOUND 4' FROM BaseFiles WHERE JobId IN (1,2);
48
49 quit
50 EOF
51
52 run_bacula
53 stop_bacula
54
55 check_two_logs
56
57 estat=0
58
59 grep -v SELECT $tmp/log2.out | grep FOUND > /dev/null
60 if [ $? = 0 ]; then
61     print_debug "Found orphan records in $tmp/log2.out"
62     estat=1
63 fi
64
65 grep -v SELECT $tmp/log3.out | grep FOUND > /dev/null
66 if [ $? = 0 ]; then
67     print_debug "Found orphan records in $tmp/log3.out"
68     estat=1
69 fi
70
71 end_test