4 # Run a simple backup of the Bacula build directory then copy it
7 TestName="prune-copy-test"
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
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')"
23 change_jobname NightlySave $JobName
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
32 # Write out bconsole commands
33 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
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 level=Full yes
43 run job=$JobName level=Full yes
47 @#setdebug level=100 dir
48 @# should copy two jobs
49 @#setdebug level=51 storage=DiskChanger
54 @#purge volume=FileVolume001
60 @# Now do another backup, but level Incremental
63 run job=$JobName level=Incremental yes
67 @# This final job that runs should be Incremental and
68 @# not upgraded to full.
70 @exec "touch $cwd/build/po/fr.po"
71 run job=$JobName level=Incremental yes
74 @$out ${cwd}/tmp/log10.out
76 setdebug level=1 director
79 SELECT JobId, Name, JobTDate, StartTime, Type, Level, JobFiles, JobStatus
80 FROM Job ORDER BY StartTime;
84 @################################################################
87 @$out ${cwd}/tmp/log2.out
89 restore where=${cwd}/tmp/bacula-restores select
101 check_for_zombie_jobs storage=File
107 # Now we will verify that the pruning code is working as expected. Each time,
108 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
109 # in argument are present in the first 'list jobs', the 'prune' command deletes
110 # them (same number), and checks that the last 'list jobs' doesn't contain them
111 # anymore. See scripts/functions.pm for details.
113 # Copy jobs are pruned like normal jobs after the Job Retention period
114 # the admin 'c'opy job should also be pruned
115 # F F c c C C I0 I -> F I
116 $bperl -e "check_prune_list('$tmp/log10.out',1,3,4,5,6,7)"
117 estat=$(($estat + $?))