#!/bin/sh # # TestName="action-on-purge-test" JobName=FIFOTest . scripts/functions cwd=`pwd` scripts/cleanup scripts/copy-test-confs echo $src > $tmp/file-list sed 's/Pool Type = Backup/Pool Type = Backup; ActionOnPurge = Truncate/' $conf/bacula-dir.conf > $tmp/1 cp $tmp/1 $conf/bacula-dir.conf start_test cat >tmp/bconcmds < $tmp/bconcmds run_bconsole perl -Mscripts::functions -e ' check_min_volume_size(4096, "TestVolume002","TestVolume003","TestVolume004","TestVolume005"); check_max_volume_size(4096, "TestVolume001")' if [ $? != 0 ]; then print_debug `ls -l $tmp` ls -l $tmp estat=2 fi echo "purge volume action storage=File" > $tmp/bconcmds run_bconsole perl -Mscripts::functions -e ' check_min_volume_size(4096, "TestVolume002", "TestVolume005"); check_max_volume_size(4096, "TestVolume001", "TestVolume003", "TestVolume004")' if [ $? != 0 ]; then print_debug `ls -l $tmp` ls -l $tmp estat=2 fi cat < $tmp/bconcmds @######################################################### @# Display catalog settings for Pool and Media @######################################################### @$out $tmp/log4.out setdebug level=0 director sql select VolumeName, ActionOnPurge FROM Media; select Name, ActionOnPurge FROM Pool; wait quit END_OF_DATA run_bconsole stop_bacula touch $tmp/log2.out check_two_logs print_debug "Test if Pool record is ok" r=`awk '/Default/ { print $4 }' $tmp/log4.out` if [ "$r" != 1 ]; then print_debug "ActionOnPurge on Pool record should be 1 ($r)" estat=2 fi print_debug "Test TestVolume001 if Media record is ok" r=`awk '/TestVolume001/ { print $4 }' $tmp/log4.out` if [ "$r" != 1 ]; then print_debug "ActionOnPurge on Media record should be 1" estat=2 fi print_debug "Test TestVolume002 if Media record is ok" r=`awk '/TestVolume002/ { print $4 }' $tmp/log4.out` if [ "$r" != 0 ]; then print_debug "ActionOnPurge on Media record should be 0" estat=2 fi end_test