]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/copy-job-test
Big backport from Enterprise
[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 echo "${cwd}/build" >${cwd}/tmp/file-list
16 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
17 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
18
19
20 change_jobname NightlySave $JobName
21 start_test
22
23 #
24 # Note, we first backup into Pool Default, 
25 #          then Copy into Pool Full. 
26 #              Pool Default uses Storage=File
27 #              Pool Full    uses Storage=DiskChanger
28
29 # Write out bconsole commands
30 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @output /dev/null
32 messages
33 @$out ${cwd}/tmp/log1.out
34 @# setdebug level=100 storage=File
35 label storage=File volume=FileVolume001 Pool=Default
36 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
37 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
38 @# run two jobs (both will be copied)
39 run job=$JobName yes
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 @#setdebug level=100 storage=File tags=dedup,asx,network options=h
49 run job=copy-job yes
50 wait
51 messages
52 @#purge volume=FileVolume001
53 list jobs 
54 list volumes
55 wait
56 messages
57 @$out ${cwd}/tmp/log3.out
58 @#
59 @# Now do another backup, but level Incremental
60 @#
61 run job=$JobName level=Incremental yes
62 wait
63 messages
64 @#
65 @# This final job that runs should be Incremental and
66 @# not upgraded to full.
67 list jobs
68 @# 
69 @# now do a restore
70 @#
71 @$out ${cwd}/tmp/log2.out
72 list volumes 
73 @#setdebug level=15 director
74 @#setdebug level=150 storage=DiskChanger
75 @# Note, here we are restoring from the original backup,
76 @#  so if you specify storage=DiskChanger the restore will fail
77 restore where=${cwd}/tmp/bacula-restores select
78 unmark *
79 mark *
80 done
81 yes
82 list volumes
83 wait
84 messages
85 quit
86 END_OF_DATA
87
88 run_bacula
89 check_for_zombie_jobs storage=File
90 stop_bacula
91
92 check_two_logs
93 check_restore_diff
94
95 grep 'Backup Level:' tmp/log3.out  | grep Incremental > /dev/null
96 if [ $? != 0 ]; then
97     bstat=2
98     print_debug "The incremental job must use copied jobs"
99 fi
100
101 end_test