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