4 TestName="action-on-purge-test"
10 scripts/copy-test-confs
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
16 change_jobname CompressedTest $JobName
19 cat >tmp/bconcmds <<END_OF_DATA
23 label storage=File volume=TestVolume001
24 label storage=File volume=TestVolume002
25 run level=full job=$JobName yes
29 restore where=${cwd}/tmp/bacula-restores select all storage=File done
33 @#########################################################
34 @# Run a second job on TestVolume002
35 @#########################################################
37 update volume=TestVolume001 volstatus=Used
41 run level=full job=$JobName yes
44 @#########################################################
45 @# Test ActionOnPurge=Truncate Volume size should be small
46 @#########################################################
47 purge volume=TestVolume001
48 @#########################################################
49 @# Test ActionOnPurge=Truncate, then update it to None
50 @# Volume size should be normal
51 @#########################################################
52 update volume=TestVolume002 actiononpurge=none
53 purge volume=TestVolume002
54 @#########################################################
55 @# Display catalog settings for Pool and Media
56 @#########################################################
59 select VolumeName, ActionOnPurge FROM Media;
60 select Name, ActionOnPurge FROM Pool;
66 check_for_zombie_jobs storage=File
72 perl -e "die 'Volume size too big' if (-s '$tmp/TestVolume001' > 4096)"
74 print_debug `ls -l $tmp/TestVolume001`
78 perl -e "die 'Volume size too small' if (-s '$tmp/TestVolume002' < 4096)"
80 print_debug `ls -l $tmp/TestVolume002`
84 print_debug "Test if Pool record is ok"
85 r=`awk '/Default/ { print $4 }' $tmp/log4.out`
86 if [ "$r" != 1 ]; then
87 print_debug "ActionOnPurge on Pool record should be 1"
91 print_debug "Test TestVolume001 if Media record is ok"
92 r=`awk '/TestVolume001/ { print $4 }' $tmp/log4.out`
93 if [ "$r" != 1 ]; then
94 print_debug "ActionOnPurge on Media record should be 1"
98 print_debug "Test TestVolume002 if Media record is ok"
99 r=`awk '/TestVolume002/ { print $4 }' $tmp/log4.out`
100 if [ "$r" != 0 ]; then
101 print_debug "ActionOnPurge on Media record should be 0"