]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/action-on-purge-test
Merge branch 'master' of ssh://bacula.git.sourceforge.net/gitroot/bacula/bacula
[bacula/bacula] / regress / tests / action-on-purge-test
1 #!/bin/sh
2 #
3 #
4 TestName="action-on-purge-test"
5 JobName=AOP
6 . scripts/functions
7
8 cwd=`pwd`
9 scripts/cleanup
10 scripts/copy-test-confs
11
12 echo $src > $tmp/file-list
13 sed 's/Pool Type = Backup/Pool Type = Backup; ActionOnPurge = Truncate/' $conf/bacula-dir.conf > $tmp/1
14 cp $tmp/1 $conf/bacula-dir.conf
15
16 change_jobname CompressedTest $JobName
17 start_test
18
19 cat >tmp/bconcmds <<END_OF_DATA
20 @$out /dev/null
21 messages
22 @$out $tmp/log1.out
23 label storage=File volume=TestVolume001
24 run job=$JobName yes
25 wait
26 messages
27 @$out $tmp/log2.out
28 restore where=${cwd}/tmp/bacula-restores select all storage=File done
29 yes
30 wait
31 messages
32 @# Test ActionOnPurge=Truncate Volume size should be small
33 @$out $tmp/log3.out
34 purge volume=TestVolume001
35 messages
36 show pool
37 @$out $tmp/log4.out
38 sql
39 select VolumeName, ActionOnPurge FROM Media;
40 select Name, ActionOnPurge FROM Pool;
41
42 quit
43 END_OF_DATA
44
45 run_bacula
46 check_for_zombie_jobs storage=File 
47 stop_bacula
48
49 check_two_logs
50 check_restore_diff
51
52 perl -e "die 'Volume size too big' if (-s '$tmp/TestVolume001' > 4096)"
53 if [ $? != 0 ]; then
54     print_debug `ls -l $tmp/TestVolume001`
55     bstat=2
56 fi
57
58 print_debug "Test if Pool record is ok"
59 r=`awk '/Default/ { print $4 }' $tmp/log4.out`
60 if [ "$r" != 1 ]; then
61     print_debug "ActionOnPurge on Pool record should be 1"
62     bstat=2
63 fi
64
65 print_debug "Test if Media record is ok"
66 r=`awk '/TestVolume001/ { print $4 }' $tmp/log4.out`
67 if [ "$r" != 1 ]; then
68     print_debug "ActionOnPurge on Media record should be 1"
69     bstat=2
70 fi
71
72 end_test