]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/copy-job-test
regress: tweak prune-migration-test
[bacula/bacula] / regress / tests / copy-job-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then copy it
4 #   to another device.
5 #
6 # This script uses the virtual disk autochanger
7 #
8 TestName="copy-job-test"
9 JobName=CopyJobSave
10 . scripts/functions
11
12
13 scripts/cleanup
14 scripts/copy-migration-confs
15 scripts/prepare-disk-changer
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
18 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
19
20
21 change_jobname NightlySave $JobName
22 start_test
23
24 #
25 # Note, we first backup into Pool Default, 
26 #          then Copy into Pool Full. 
27 #              Pool Default uses Storage=File
28 #              Pool Full    uses Storage=DiskChanger
29
30 # Write out bconsole commands
31 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
32 @$out /dev/null
33 messages
34 @$out ${cwd}/tmp/log1.out
35 @# setdebug level=100 storage=File
36 label storage=File volume=FileVolume001 Pool=Default
37 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
38 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
39 @# run two jobs (both will be copied)
40 run job=$JobName yes
41 run job=$JobName yes
42 wait
43 list jobs
44 list volumes
45 @#setdebug level=100 dir
46 @# should copy two jobs
47 @#setdebug level=51 storage=DiskChanger
48 run job=copy-job yes
49 wait
50 messages
51 @#purge volume=FileVolume001
52 list jobs 
53 list volumes
54 wait
55 messages
56 @$out ${cwd}/tmp/log3.out
57 @#
58 @# Now do another backup, but level Incremental
59 @#
60 run job=$JobName level=Incremental yes
61 wait
62 messages
63 @#
64 @# This final job that runs should be Incremental and
65 @# not upgraded to full.
66 list jobs
67 @# 
68 @# now do a restore
69 @#
70 @$out ${cwd}/tmp/log2.out
71 list volumes 
72 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
73 unmark *
74 mark *
75 done
76 yes
77 list volumes
78 wait
79 messages
80 quit
81 END_OF_DATA
82
83 run_bacula
84 check_for_zombie_jobs storage=File
85 stop_bacula
86
87 check_two_logs
88 check_restore_diff
89
90 grep 'Backup Level:' tmp/log3.out  | grep Incremental > /dev/null
91 if [ $? != 0 ]; then
92     bstat=2
93     print_debug "The incremental job must use copied jobs"
94 fi
95
96 end_test