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