]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/prune-copy-test
4c1217806de1595ea530052d633d79dcdf96f7e2
[bacula/bacula] / regress / tests / prune-copy-test
1 #!/bin/sh
2 # Not yet working
3 #
4 # Run a simple backup of the Bacula build directory then copy it
5 #   to another device.
6 ##
7 TestName="prune-copy-test"
8 JobName=CopyJobSave
9 . scripts/functions
10
11
12 scripts/cleanup
13 scripts/copy-migration-confs
14 scripts/prepare-disk-changer
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 dircfg=$conf/bacula-dir.conf
20 $bperl -e "add_attribute('$dircfg', 'AutoPrune', 'No', 'Client')"
21 $bperl -e "add_attribute('$dircfg', 'Job Retention', '1s', 'Client')"
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 @$out /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 @sleep 2
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 run job=copy-job yes
52 wait
53 messages
54 @#purge volume=FileVolume001
55 list jobs 
56 list volumes
57 wait
58 messages
59 @#
60 @# Now do another backup, but level Incremental
61 @#
62 run job=$JobName level=Incremental yes
63 wait
64 messages
65 @#
66 @# This final job that runs should be Incremental and
67 @# not upgraded to full.
68 @exec "touch $cwd/build/po/fr.po"
69 run job=$JobName level=Incremental yes
70 wait
71 messages
72 @$out ${cwd}/tmp/log10.out
73 @sleep 1
74 list jobs
75 prune jobs yes
76 list jobs
77 @################################################################ 
78 @# now do a restore
79 @#
80 @$out ${cwd}/tmp/log2.out
81 list volumes 
82 restore where=${cwd}/tmp/bacula-restores select
83 unmark *
84 mark *
85 done
86 yes
87 list volumes
88 wait
89 messages
90 quit
91 END_OF_DATA
92
93 run_bacula
94 check_for_zombie_jobs storage=File
95 stop_bacula
96
97 check_two_logs
98 check_restore_diff
99
100 # Now we will verify that the pruning code is working as expected.  Each time,
101 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
102 # in argument are present in the first 'list jobs', the 'prune' command deletes
103 # them (same number), and checks that the last 'list jobs' doesn't contain them
104 # anymore. See scripts/functions.pm for details.
105
106 # Copy jobs are pruned like normal jobs after the Job Retention period
107 # the admin 'c'opy job should also be pruned
108 # F F c c C C I0 I -> F I
109 $bperl -e "check_prune_list('$tmp/log10.out',1,3,4,5,6,7)"
110 estat=$(($estat + $?))
111
112 end_test