3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # This script will test prune algo
16 scripts/copy-test-confs
21 echo $PWD/build/po > tmp/file-list
23 # We want to have pruning only when doing prune command
24 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "AutoPrune", "No", "Client")'
25 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Job Retention", "1s", "Client")'
27 cat <<EOF > ${cwd}/tmp/bconcmds
31 label storage=File volume=TestVolume001
32 run job=$JobName level=full yes
35 @exec "touch $cwd/build/po/fr.po"
36 run job=$JobName level=incremental yes
39 @exec "touch $cwd/build/po/de.po"
40 run job=$JobName level=incremental yes
45 @################################################################
46 @# Should not prune anything
51 @################################################################
52 @# Should prune the two firsts incrementals
53 run job=$JobName level=differential yes
56 @exec "touch $cwd/build/po/es.po"
57 run job=$JobName level=incremental yes
65 @################################################################
66 @# Should prune the first Full+Diff job
67 run job=$JobName level=full yes
75 @################################################################
76 run job=$JobName level=incremental yes
80 restore where=${cwd}/tmp/bacula-restores select all storage=File done
86 @################################################################
87 @# Should prune the restore job and the last incremental job (jobfiles=0)
96 check_for_zombie_jobs storage=File
103 ###############################################################################
104 # Now we will verify that the pruning code is working as expected. Each time,
105 # we run 'list jobs', 'prune', 'list jobs'. check_prune_list ensures that jobids
106 # in argument are present in the first 'list jobs', the 'prune' command deletes
107 # them (same number), and checks that the last 'list jobs' doesn't contain them
108 # anymore. See scripts/functions.pm for details.
110 # nothing should be pruned
111 $bperl -e "check_prune_list('$tmp/log3.out')"
112 estat=$(($estat + $?))
114 # jobids 2 and 3 should be pruned
116 $bperl -e "check_prune_list('$tmp/log4.out',2,3)"
117 estat=$(($estat + $?))
120 $bperl -e "check_prune_list('$tmp/log5.out',1,4,5)"
121 estat=$(($estat + $?))
123 # (F I R) -> (F) -- Incremental have 0 file
124 $bperl -e "check_prune_list('$tmp/log6.out',7,8)"
125 estat=$(($estat + $?))