]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/next-pool-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / next-pool-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Test various nextpool options for copy/migration
7 #
8 TestName="next-pool-test"
9 JobName=Virtual
10
11 . scripts/functions
12 ${rscripts}/cleanup
13 cp -f ${rscripts}/bacula-dir-2media-virtual.conf ${conf}/bacula-dir.conf
14 cp -f ${rscripts}/bacula-sd-2media-virtual.conf ${conf}/bacula-sd.conf
15 cp -f ${rscripts}/test-bacula-fd.conf ${conf}/bacula-fd.conf
16 cp -f ${rscripts}/test-console.conf ${conf}/bconsole.conf
17
18 echo "$cwd/build/src/dird" >${cwd}/tmp/file-list
19
20 $bperl -e 'add_attribute("$conf/bacula-sd.conf", "Label Media", "Yes", "Device")'
21 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Label Format", "Vol-", "Pool")'
22
23 # create where the SD is putting volumes
24 mkdir -p $tmp/disk
25
26 # The 3rd drive doesn't have the right type
27 sed  's/disk1/disk/' $conf/bacula-sd.conf > 1
28 cp -f 1 $conf/bacula-sd.conf
29
30 start_test
31
32 cat <<END_OF_DATA >${tmp}/bconcmds
33 @output /dev/null
34 messages
35 @$out $tmp/log1.out
36 run job=Virtual yes
37 wait
38 messages
39 @$out $tmp/log3.out
40 @# Looking for: FullCopy
41 run job=copy-job jobid=1
42 yes
43 wait
44 messages
45 @$out $tmp/log4.out
46 @# Looking for: Special
47 run job=copy-job jobid=1
48 mod
49 9
50 4
51 yes
52 wait
53 messages
54 @$out $tmp/log5.out
55 @# Looking for: Special
56 run job=copy-job jobid=1 nextpool=Special
57 yes
58 wait
59 messages
60 @$out $tmp/log6.out
61 run job=copy-job-next-pool jobid=1
62 yes
63 wait
64 messages
65 @$out $tmp/log7.out
66 run job=copy-job-next-pool nextpool=FullCopy jobid=1
67 yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72
73 run_bacula
74 check_for_zombie_jobs storage=Virtual
75 stop_bacula
76
77 # menu
78 # Pool:          Default (From Job resource)
79 # NextPool:      FullCopy (From Job Pool's NextPool resource)
80 # Read Storage:  Virtual (From Job resource)
81 # Write Storage: Virtual (From Job Pool's NextPool resource)
82
83 # output
84 # Read Pool:              "Default" (From Job resource)
85 # Read Storage:           "Virtual" (From Job resource)
86 # Write Pool:             "FullCopy" (From Job Pool's NextPool resource)
87 # Write Storage:          "Virtual" (From Job Pool's NextPool resource)
88
89 grep "NextPool:      FullCopy (From Job Pool's NextPool resource)" $tmp/log3.out > /dev/null
90 if [ $? != 0 ]; then
91     print_debug "ERROR: Bad NextPool in $tmp/log3.out, should be FullCopy"
92     estat=1
93 fi
94
95 grep "Write Storage: Virtual (From Job Pool" $tmp/log3.out > /dev/null
96 if [ $? != 0 ]; then
97     print_debug "ERROR: Bad Write Storage in $tmp/log3.out, should be Virtual"
98     estat=1
99 fi
100
101 grep 'Write Pool:             "FullCopy"' $tmp/log3.out > /dev/null
102 if [ $? != 0 ]; then
103     print_debug "ERROR: Bad Write Pool in $tmp/log3.out, should be FullCopy"
104     estat=1
105 fi
106
107 # log4.out
108 # Pool:          Default (From Job resource)
109 # NextPool:      Special (From User input)
110 # Read Storage:  Virtual (From Job resource)
111 # Write Storage: Virtual (From User input)
112
113 #  Read Pool:              "Default" (From Job resource)
114 #  Read Storage:           "Virtual" (From Job resource)
115 #  Write Pool:             "Special" (From User input)
116 #  Write Storage:          "Virtual" (From User input)
117
118 grep "NextPool:      Special (From User input)" $tmp/log4.out > /dev/null
119 if [ $? != 0 ]; then
120     print_debug "ERROR: Bad NextPool in $tmp/log4.out, should find Special"
121     estat=1
122 fi
123
124 grep "Write Storage: Virtual2 (From User input)" $tmp/log4.out > /dev/null
125 if [ $? != 0 ]; then
126     print_debug "ERROR: Bad Write Storage in $tmp/log4.out, should be Virtual"
127     estat=1
128 fi
129
130 grep 'Write Pool:             "Special"' $tmp/log4.out > /dev/null
131 if [ $? != 0 ]; then
132     print_debug "ERROR: Bad Write Pool in $tmp/log4.out, should be Special"
133     estat=1
134 fi
135
136 # log5.out
137 # Pool:          Default (From Job resource)
138 # NextPool:      Special (From Command input)
139 # Read Storage:  Virtual (From Job resource)
140 # Write Storage: Virtual2 (From Command input)
141
142 # Read Pool:              "Default" (From Job resource)
143 # Read Storage:           "Virtual" (From Job resource)
144 # Write Pool:             "Special" (From Command input)
145 # Write Storage:          "Virtual2" (From Command input)
146
147 grep "NextPool:      Special (From Command input)" $tmp/log5.out > /dev/null
148 if [ $? != 0 ]; then
149     print_debug "ERROR: Bad NextPool in $tmp/log5.out, should find Special"
150     estat=1
151 fi
152
153 grep "Write Storage: Virtual2 (From Command input)" $tmp/log5.out > /dev/null
154 if [ $? != 0 ]; then
155     print_debug "ERROR: Bad Write Storage in $tmp/log5.out, should be Virtual"
156     estat=1
157 fi
158
159 grep 'Write Pool:             "Special"' $tmp/log5.out > /dev/null
160 if [ $? != 0 ]; then
161     print_debug "ERROR: Bad Write Pool in $tmp/log5.out, should be Special"
162     estat=1
163 fi
164
165
166 # log6.out
167 # Pool:          Default (From Job resource)
168 # NextPool:      Special (From Job resource)
169 # Write Pool:             "Special" (From Job resource)
170
171 grep "NextPool:      Special (From Job resource)" $tmp/log6.out > /dev/null
172 if [ $? != 0 ]; then
173     print_debug "ERROR: Bad NextPool in $tmp/log6.out, should find Special"
174     estat=1
175 fi
176
177 grep 'Write Pool:             "Special" (From Job resource)' $tmp/log6.out > /dev/null
178 if [ $? != 0 ]; then
179     print_debug "ERROR: Bad NextPool in $tmp/log6.out, should find Special"
180     estat=1
181 fi
182
183 # log7.out
184 # NextPool:      FullCopy (From command line)
185 # Write Pool:             "FullCopy" (From command line)
186
187 grep "NextPool:      FullCopy (From Command input)" $tmp/log7.out > /dev/null
188 if [ $? != 0 ]; then
189     print_debug "ERROR: Bad NextPool in $tmp/log7.out, should find Special"
190     estat=1
191 fi
192
193 grep 'Write Pool:             "FullCopy" (From Command input)' $tmp/log7.out > /dev/null
194 if [ $? != 0 ]; then
195     print_debug "ERROR: Bad NextPool in $tmp/log7.out, should find Special"
196     estat=1
197 fi
198
199
200 end_test