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