]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/scratch-pool-test
Big backport from Enterprise
[bacula/bacula] / regress / tests / scratch-pool-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 # Run a simple backup of the Bacula build directory 
7 #  to two tapes where the maximum tape file size is set to 1M
8 #  Note, this test simulates the tape filling and writing to
9 #   the next tape. One minor wrinkle: we create the two tapes
10 #   in the Scratch pool, so they should be switched to the Default
11 #   Pool automatically.
12 # We set TestVolume001 to not in the changer, so the algorithm
13 #   should find TestVolume002 and use it rather than blocking.
14 #
15 #  Note we use the viritual disk autochanger
16 #
17 TestName="scratch-pool-test"
18 JobName=scratch-pool
19 . scripts/functions
20
21 if test x${AUTOCHANGER} = x/dev/null ; then
22    echo "two-volume-test skipped. No autochanger."
23    exit
24 fi
25 cwd=`pwd`
26 scripts/cleanup
27 scripts/copy-2disk-confs
28 scripts/prepare-disk-changer
29  
30 echo "${cwd}/build" >${cwd}/tmp/file-list
31
32 outf="${cwd}/tmp/sed_tmp"
33 echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
34 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
35 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
36
37 change_jobname NightlySave $JobName
38 start_test
39
40 # Write out bconsole commands
41 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
42 @output /dev/null
43 messages
44 @$out ${cwd}/tmp/log1.out
45 label storage=tape volume=TestVolume001 slot=1 pool=Scratch drive=0
46 label storage=tape volume=TestVolume002 slot=2 pool=Scratch drive=0
47 update Volume=TestVolume001 MaxVolBytes=2000000 pool=Scratch drive=0
48 update Volume=TestVolume001 inchanger=no pool=Scratch drive=0
49 @#setdebug level=200 storage=tape
50 llist volume=TestVolume001
51 llist volume=TestVolume002
52 run job=$JobName yes
53 wait
54 messages
55 list volumes
56 llist volume=TestVolume001
57 @# 
58 @# now do a restore
59 @#
60 @# Check if JobMedia OK (run under Aligned)
61 sql
62 select jobid, mediaid, firstindex,lastindex,volindex from JobMedia order by jobid,volindex;
63 select * from JobMedia order by jobid,volindex;
64
65 @$out ${cwd}/tmp/log2.out
66 restore where=${cwd}/tmp/bacula-restores select all storage=tape done
67 yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72
73 run_bacula
74 check_for_zombie_jobs storage=tape
75 stop_bacula
76
77 check_two_logs
78 check_restore_diff
79 end_test