3 # This script will test prune algo
11 scripts/copy-test-confs
15 echo $PWD/build/po > tmp/file-list
17 # We want to have pruning only when doing prune command
18 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "No", "Client")'
19 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Job Retention", "1s", "Client")'
21 cat <<EOF > ${cwd}/tmp/bconcmds
25 label storage=File volume=TestVolume001
26 run job=$JobName level=full yes
29 @exec "touch $cwd/build/po/fr.po"
30 run job=$JobName level=incremental yes
33 @exec "touch $cwd/build/po/de.po"
34 run job=$JobName level=incremental yes
39 @################################################################
40 @# Should not prune anything
45 @################################################################
46 @# Should prune the two firsts incrementals
47 run job=$JobName level=differential yes
50 @exec "touch $cwd/build/po/es.po"
51 run job=$JobName level=incremental yes
59 @################################################################
60 @# Should prune the first Full+Diff job
61 run job=$JobName level=full yes
69 @################################################################
70 run job=$JobName level=incremental yes
74 restore where=${cwd}/tmp/bacula-restores select all storage=File done
80 @################################################################
81 @# Should prune the restore job and the last incremental job (jobfiles=0)
90 check_for_zombie_jobs storage=File
97 ###############################################################################
98 # Now we will verify that the pruning code is working as expected. Each time,
99 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
100 # in argument are present in the first 'list jobs', the 'prune' command deletes
101 # them (same number), and checks that the last 'list jobs' doesn't contain them
102 # anymore. See scripts/functions.pm for details.
104 # nothing should be pruned
105 $bperl -e "check_prune_list('$tmp/log3.out')"
106 estat=$(($estat + $?))
108 # jobids 2 and 3 should be pruned
110 $bperl -e "check_prune_list('$tmp/log4.out',2,3)"
111 estat=$(($estat + $?))
114 $bperl -e "check_prune_list('$tmp/log5.out',1,4,5)"
115 estat=$(($estat + $?))
117 # (F I R) -> (F) -- Incremental have 0 file
118 $bperl -e "check_prune_list('$tmp/log6.out',7,8)"
119 estat=$(($estat + $?))