]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/prune-copy-test
regress: Add a deleted file test for restart
[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 label storage=File volume=FileVolume001 Pool=Default
38 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
39 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
40 @# run two jobs (both will be copied)
41 run job=$JobName yes
42 @sleep 2
43 run job=$JobName yes
44 wait
45 list jobs
46 list volumes
47 @#setdebug level=100 dir
48 @# should copy two jobs
49 @#setdebug level=51 storage=DiskChanger
50 @sleep 2
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 @sleep 2
63 run job=$JobName level=Incremental yes
64 wait
65 messages
66 @#
67 @# This final job that runs should be Incremental and
68 @# not upgraded to full.
69 @sleep 2
70 @exec "touch $cwd/build/po/fr.po"
71 run job=$JobName level=Incremental yes
72 wait
73 messages
74 @$out ${cwd}/tmp/log10.out
75 @sleep 1
76 setdebug level=1 director
77 list jobs
78 prune jobs yes
79 list jobs
80 @################################################################ 
81 @# now do a restore
82 @#
83 @$out ${cwd}/tmp/log2.out
84 list volumes 
85 restore where=${cwd}/tmp/bacula-restores select
86 unmark *
87 mark *
88 done
89 yes
90 list volumes
91 wait
92 messages
93 quit
94 END_OF_DATA
95
96 run_bacula
97 check_for_zombie_jobs storage=File
98 stop_bacula
99
100 check_two_logs
101 check_restore_diff
102
103 # Now we will verify that the pruning code is working as expected.  Each time,
104 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
105 # in argument are present in the first 'list jobs', the 'prune' command deletes
106 # them (same number), and checks that the last 'list jobs' doesn't contain them
107 # anymore. See scripts/functions.pm for details.
108
109 # Copy jobs are pruned like normal jobs after the Job Retention period
110 # the admin 'c'opy job should also be pruned
111 # F F c c C C I0 I -> F I
112 $bperl -e "check_prune_list('$tmp/log10.out',1,3,4,5,6,7)"
113 estat=$(($estat + $?))
114
115 end_test