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
28 restore where=${cwd}/tmp/bacula-restores select all storage=File done
32 @#########################################################
33 @# Test ActionOnPurge=Truncate Volume size should be small
34 @#########################################################
36 purge volume=TestVolume001
39 update volume=TestVolume001 volstatus=Read-Only
41 label storage=File volume=TestVolume002
45 @#########################################################
46 @# Test ActionOnPurge=Truncate, then update it to None
47 @# Volume size should be normal
48 @#########################################################
49 update volume=TestVolume002 actiononpurge=none
50 purge volume=TestVolume002
51 @#########################################################
52 @# Display catalog settings for Pool and Media
53 @#########################################################
56 select VolumeName, ActionOnPurge FROM Media;
57 select Name, ActionOnPurge FROM Pool;
63 check_for_zombie_jobs storage=File
69 perl -e "die 'Volume size too big' if (-s '$tmp/TestVolume001' > 4096)"
71 print_debug `ls -l $tmp/TestVolume001`
75 perl -e "die 'Volume size too small' if (-s '$tmp/TestVolume002' < 4096)"
77 print_debug `ls -l $tmp/TestVolume002`
81 print_debug "Test if Pool record is ok"
82 r=`awk '/Default/ { print $4 }' $tmp/log4.out`
83 if [ "$r" != 1 ]; then
84 print_debug "ActionOnPurge on Pool record should be 1"
88 print_debug "Test TestVolume001 if Media record is ok"
89 r=`awk '/TestVolume001/ { print $4 }' $tmp/log4.out`
90 if [ "$r" != 1 ]; then
91 print_debug "ActionOnPurge on Media record should be 1"
95 print_debug "Test TestVolume002 if Media record is ok"
96 r=`awk '/TestVolume002/ { print $4 }' $tmp/log4.out`
97 if [ "$r" != 0 ]; then
98 print_debug "ActionOnPurge on Media record should be 0"