]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/migration-job-purge-test
Add more debug to recycle-test
[bacula/bacula] / regress / tests / migration-job-purge-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 migrate it
9 #   to another device, and see if PurgeMigrationJob works as expected.
10 #
11 # This script uses the virtual disk autochanger
12 #
13 TestName="migration-job-purge-test"
14 JobName=MigrationJobSave
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
23 change_jobname NightlySave $JobName
24
25 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "PurgeMigrationJob", "yes", "Job", "migrate-job")'
26
27 start_test
28
29 #
30 # Note, we first backup into Pool Default, 
31 #          then Migrate 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=000 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 migrated)
45 run job=$JobName yes
46 run job=$JobName yes
47 wait
48 list jobs
49 list volumes
50 @#setdebug level=100 dir
51 @# should migrate two jobs
52 @#setdebug level=51 storage=DiskChanger
53 run job=migrate-job yes
54 wait
55 messages
56 @# purge volume=FileVolume001
57 list jobs 
58 list volumes
59 list joblog jobid=6
60 wait
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 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
77 unmark *
78 mark *
79 done
80 yes
81 list volumes
82 wait
83 messages
84 @$out ${cwd}/tmp/log3.out
85 list jobid=1
86 list jobid=2
87 quit
88 END_OF_DATA
89
90 run_bacula
91 check_for_zombie_jobs storage=File
92 stop_bacula
93
94 check_two_logs
95 check_restore_diff
96
97 # Shouldn't find MigrationJobSave jobid 1 or 2 in log3.out
98 grep MigrationJobSave $tmp/log3.out
99 if [ $? -eq 0 ]; then
100     print_debug "ERROR: found purged jobids in $tmp/log3.out"
101     estat=1
102 fi
103
104 end_test