]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/scratchpool-pool-test
ebl tweak output
[bacula/bacula] / regress / tests / scratchpool-pool-test
1 #!/bin/sh
2 #
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
9 #   Pool automatically.
10 #
11 #  Note we use the viritual disk autochanger
12 #
13 TestName="scratchpool-pool-test"
14 JobName=scratchpool-pool
15 . scripts/functions
16
17 # This test hangs so disable it
18 exit
19
20 cwd=`pwd`
21 scripts/cleanup
22 scripts/copy-2disk-confs
23 scripts/prepare-disk-changer
24  
25 echo "${cwd}/build" >${cwd}/tmp/file-list
26
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
31
32 change_jobname NightlySave $JobName
33 start_test
34
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @$out /dev/null
38 messages
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
43 show pool=Default
44 show pool=Special
45 @########################
46 @# Verify catalog entries
47 @$out ${cwd}/tmp/pool.out
48 sql
49 SELECT Name, ScratchPoolId, RecyclePoolId FROM Pool WHERE Name IN ('Default', 'Special');
50
51 @$out ${cwd}/tmp/log1.out
52 @########################
53 @# Use SpecialScratch
54 run job=$JobName pool=Special yes
55 wait
56 messages
57 run job=$JobName pool=Special level=Full yes
58 wait
59 messages
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
64 wait mount
65 @sleep 1
66 cancel jobid=3
67 messages
68 @$out ${cwd}/tmp/log4.out
69 list volume pool=Special
70 @# 
71 @# now do a restore
72 @#
73 @$out ${cwd}/tmp/log2.out
74 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
75 yes
76 wait
77 messages
78 @$out
79 quit
80 END_OF_DATA
81
82 run_bacula
83 check_for_zombie_jobs storage=DDS-4
84 stop_bacula
85
86 check_two_logs
87 check_restore_diff
88
89
90 ################################################################
91 # Check Catalog definition for ScratchPool and RecyclePool
92 awk '
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
96
97 grep ERR tmp/res
98 if [ $? -eq 0 ]; then
99     print_debug "Found ERR about ScratchPoolId/RecyclePoolId in catalog"
100     dstat=2
101 fi
102
103 if [ `cat tmp/res | wc -l` -ne 2 ]; then
104     print_debug "Can't find all pool records in catalog"
105     dstat=2
106 fi
107
108 ################################################################
109 # Check for the third job that must fail because the SpecialScratch is empty
110
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!!"
114     dstat=2
115 fi
116
117 grep 'Backup Error' tmp/log3.out > /dev/null
118 if [ $? -ne 0 ]; then
119     print_debug "Job 3 should be in error"
120     dstat=2
121 fi
122
123 ################################################################
124 # Check Special pool
125
126 if [ `grep TestVolume00 tmp/log4.out | wc -l` -ne 2 ]; then
127     print_debug "Special pool should contain 2 vols"
128     dstat=2
129 fi
130
131 end_test