From c093f3224d764041fb082868e1e9c63a46118687 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 27 Jan 2009 16:43:14 +0000 Subject: [PATCH] ebl Add test for new ScratchPool directive git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8405 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/tests/scratchpool-pool-test | 128 ++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100755 regress/tests/scratchpool-pool-test diff --git a/regress/tests/scratchpool-pool-test b/regress/tests/scratchpool-pool-test new file mode 100755 index 0000000000..6a299e4384 --- /dev/null +++ b/regress/tests/scratchpool-pool-test @@ -0,0 +1,128 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to two tapes where the maximum tape file size is set to 1M +# Note, this test simulates the tape filling and writing to +# the next tape. One minor wrinkle: we create the two tapes +# in the special ScratchPool defined in pool, so they should +# be switched to the Special +# Pool automatically. +# +# Note we use the viritual disk autochanger +# +TestName="scratchpool-pool-test" +JobName=scratchpool-pool +. scripts/functions + +cwd=`pwd` +scripts/cleanup +scripts/copy-2disk-confs +scripts/prepare-disk-changer + +echo "${cwd}/build" >${cwd}/tmp/file-list + +outf="${cwd}/tmp/sed_tmp" +echo "s%# Maximum File Size% Maximum File Size%g" >${outf} +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname NightlySave $JobName +start_test + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@$out /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 pool=SpecialScratch drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 pool=SpecialScratch drive=0 +label storage=DDS-4 volume=TestVolume003 slot=3 pool=Scratch drive=0 +show pool=Default +show pool=Special +@######################## +@# Verify catalog entries +@$out ${cwd}/tmp/pool.out +sql +SELECT Name, ScratchPoolId, RecyclePoolId FROM Pool WHERE Name IN ('Default', 'Special'); + +@$out ${cwd}/tmp/log1.out +@######################## +@# Use SpecialScratch +run job=$JobName pool=Special yes +wait +messages +run job=$JobName pool=Special level=Full yes +wait +messages +@$out ${cwd}/tmp/log3.out +@######################## +@# no more volume in SpecialScratch (but Scrach have one) +run job=$JobName pool=Special level=Full yes +@sleep 10 +cancel jobid=3 +wait +messages +@$out ${cwd}/tmp/log4.out +list volume pool=Special +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff + + +################################################################ +# Check Catalog definition for ScratchPool and RecyclePool +awk ' + / Default/ { if ($4 == 0 && $6 != 0) {print "OK"} else { print "Default ERR"} } + / Special/ { if ($4 != 0 && $6 == 0) {print "OK"} else { print "Special ERR"} } +' tmp/pool.out > tmp/res + +grep ERR tmp/res +if [ $? -eq 0 ]; then + print_debug "Found ERR about ScratchPoolId/RecyclePoolId in catalog" + dstat=2 +fi + +if [ `cat tmp/res | wc -l` -ne 2 ]; then + print_debug "Can't find all pool records in catalog" + dstat=2 +fi + +################################################################ +# Check for the third job that must fail because the SpecialScratch is empty + +grep 'Cannot find any appendable volumes' tmp/log3.out > /dev/null +if [ $? -ne 0 ]; then + print_debug "Job 3 should request a manual intervention!!" + dstat=2 +fi + +grep 'Backup Error' tmp/log3.out > /dev/null +if [ $? -ne 0 ]; then + print_debug "Job 3 should be in error" + dstat=2 +fi + +################################################################ +# Check Special pool + +if [ `grep TestVolume00 tmp/log4.out | wc -l` -ne 2 ]; then + print_debug "Special pool should contain 2 vols" + dstat=2 +fi + +end_test -- 2.39.5