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
17 # This test hangs so disable it
22 scripts/copy-2disk-confs
23 scripts/prepare-disk-changer
25 echo "${cwd}/build" >${cwd}/tmp/file-list
27 outf="${cwd}/tmp/sed_tmp"
28 echo "s%# Maximum File Size% Maximum File Size%g" >${outf}
29 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
30 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
32 change_jobname NightlySave $JobName
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
39 @$out ${cwd}/tmp/log1.out
40 label storage=DDS-4 volume=TestVolume001 slot=1 pool=SpecialScratch drive=0
41 label storage=DDS-4 volume=TestVolume002 slot=2 pool=SpecialScratch drive=0
42 label storage=DDS-4 volume=TestVolume003 slot=3 pool=Scratch drive=0
45 @########################
46 @# Verify catalog entries
47 @$out ${cwd}/tmp/pool.out
49 SELECT Name, ScratchPoolId, RecyclePoolId FROM Pool WHERE Name IN ('Default', 'Special');
51 @$out ${cwd}/tmp/log1.out
52 @########################
54 run job=$JobName pool=Special yes
57 run job=$JobName pool=Special level=Full yes
60 @$out ${cwd}/tmp/log3.out
61 @########################
62 @# no more volume in SpecialScratch (but Scrach have one)
63 run job=$JobName pool=Special level=Full yes
68 @$out ${cwd}/tmp/log4.out
69 list volume pool=Special
73 @$out ${cwd}/tmp/log2.out
74 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
83 check_for_zombie_jobs storage=DDS-4
90 ################################################################
91 # Check Catalog definition for ScratchPool and RecyclePool
93 / Default/ { if ($4 == 0 && $6 != 0) {print "OK"} else { print "Default ERR"} }
94 / Special/ { if ($4 != 0 && $6 == 0) {print "OK"} else { print "Special ERR"} }
95 ' tmp/pool.out > tmp/res
99 print_debug "Found ERR about ScratchPoolId/RecyclePoolId in catalog"
103 if [ `cat tmp/res | wc -l` -ne 2 ]; then
104 print_debug "Can't find all pool records in catalog"
108 ################################################################
109 # Check for the third job that must fail because the SpecialScratch is empty
111 grep 'Cannot find any appendable volumes' tmp/log3.out > /dev/null
112 if [ $? -ne 0 ]; then
113 print_debug "Job 3 should request a manual intervention!!"
117 grep 'Backup Error' tmp/log3.out > /dev/null
118 if [ $? -ne 0 ]; then
119 print_debug "Job 3 should be in error"
123 ################################################################
126 if [ `grep TestVolume00 tmp/log4.out | wc -l` -ne 2 ]; then
127 print_debug "Special pool should contain 2 vols"