3 # Run a simple backup of the Bacula build directory
4 # to two tapes where the maximum tape file size is set to 1M
5 # Note, this test simulates the tape filling and writing to
6 # the next tape. One minor wrinkle: we create the two tapes
7 # in the special ScratchPool defined in pool, so they should
8 # be switched to the Special
11 # Note we use the viritual disk autochanger
13 TestName="scratchpool-pool-test"
14 JobName=scratchpool-pool
19 scripts/copy-2disk-confs
20 scripts/prepare-disk-changer
22 echo "${cwd}/build" >${cwd}/tmp/file-list
24 outf="${cwd}/tmp/sed_tmp"
25 echo "s%# Maximum File Size% Maximum File Size%g" >${outf}
26 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
27 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
29 change_jobname NightlySave $JobName
32 # Write out bconsole commands
33 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
36 @$out ${cwd}/tmp/log1.out
37 label storage=DDS-4 volume=TestVolume001 slot=1 pool=SpecialScratch drive=0
38 label storage=DDS-4 volume=TestVolume002 slot=2 pool=SpecialScratch drive=0
39 label storage=DDS-4 volume=TestVolume003 slot=3 pool=Scratch drive=0
42 @########################
43 @# Verify catalog entries
44 @$out ${cwd}/tmp/pool.out
46 SELECT Name, ScratchPoolId, RecyclePoolId FROM Pool WHERE Name IN ('Default', 'Special');
48 @$out ${cwd}/tmp/log1.out
49 @########################
51 run job=$JobName pool=Special yes
54 run job=$JobName pool=Special level=Full yes
57 @$out ${cwd}/tmp/log3.out
58 @########################
59 @# no more volume in SpecialScratch (but Scrach have one)
60 run job=$JobName pool=Special level=Full yes
65 @$out ${cwd}/tmp/log4.out
66 list volume pool=Special
70 @$out ${cwd}/tmp/log2.out
71 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
80 check_for_zombie_jobs storage=DDS-4
87 ################################################################
88 # Check Catalog definition for ScratchPool and RecyclePool
90 / Default/ { if ($4 == 0 && $6 != 0) {print "OK"} else { print "Default ERR"} }
91 / Special/ { if ($4 != 0 && $6 == 0) {print "OK"} else { print "Special ERR"} }
92 ' tmp/pool.out > tmp/res
96 print_debug "Found ERR about ScratchPoolId/RecyclePoolId in catalog"
100 if [ `cat tmp/res | wc -l` -ne 2 ]; then
101 print_debug "Can't find all pool records in catalog"
105 ################################################################
106 # Check for the third job that must fail because the SpecialScratch is empty
108 grep 'Cannot find any appendable volumes' tmp/log3.out > /dev/null
109 if [ $? -ne 0 ]; then
110 print_debug "Job 3 should request a manual intervention!!"
114 grep 'Backup Error' tmp/log3.out > /dev/null
115 if [ $? -ne 0 ]; then
116 print_debug "Job 3 should be in error"
120 ################################################################
123 if [ `grep TestVolume00 tmp/log4.out | wc -l` -ne 2 ]; then
124 print_debug "Special pool should contain 2 vols"