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