]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/prune-config-test
regress: fix delete-test
[bacula/bacula] / regress / tests / prune-config-test
1 #!/bin/sh
2 #
3 # This script will test prune algo 
4 #
5 . scripts/functions
6
7 TestName="prune-test"
8 JobName=NightlySave
9
10 scripts/cleanup
11 scripts/copy-test-confs
12
13 start_test
14
15 echo $PWD/build/po > tmp/file-list
16
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")'
20
21 # Add a new job with a different fileset
22 $bperl -e 'print get_resource("$conf/bacula-dir.conf", "Job", "NightlySave")' | \
23     sed s/NightlySave/DailySave/ | sed 's/Full Set/CompressedSet/' > $tmp/1
24
25 cat $tmp/1 >> $conf/bacula-dir.conf
26
27 cat <<EOF > ${cwd}/tmp/bconcmds
28 @$out /dev/null
29 messages
30 @$out $tmp/log1.out
31 label storage=File volume=TestVolume001
32 run job=$JobName level=full yes
33 wait
34 messages
35 @exec "touch $cwd/build/po/fr.po"
36 run job=$JobName level=incremental yes
37 wait
38 messages
39 @exec "touch $cwd/build/po/de.po"
40 run job=$JobName level=incremental yes
41 wait
42 messages
43 @# run a second set of backup
44 run job=DailySave level=full yes
45 wait
46 messages
47 @exec "touch $cwd/build/po/fr.po"
48 run job=DailySave level=incremental yes
49 wait
50 messages
51 @exec "touch $cwd/build/po/de.po"
52 run job=DailySave level=incremental yes
53 wait
54 messages
55 @sleep 2
56 @$out $tmp/log10.out
57 @# should prune nothing
58 list jobs
59 prune jobs yes
60 list jobs
61 quit
62 EOF
63
64 run_bacula
65
66 # should find nothing to prune
67 $bperl -e "check_prune_list('$tmp/log10.out')"
68
69 # rename the job to see if it's pruned
70 sed s/DailySave/DisabledBackup/ $conf/bacula-dir.conf > $tmp/1
71 mv $tmp/1 $conf/bacula-dir.conf
72
73 cat <<EOF > ${cwd}/tmp/bconcmds
74 @$out tmp/log11.out
75 reload
76 messages
77 @# should prune jobs using DailySave
78 list jobs
79 prune jobs yes
80 list jobs
81 EOF
82
83 run_bconsole
84
85 $bperl -e "check_prune_list('$tmp/log11.out', 4, 5, 6)"
86 estat=$(($estat + $?))
87
88 # rename Full Set fileset to see if it will be pruned the next time
89 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "FileSet", "CompressedSet", "Job", "NightlySave")'
90 sed "s/Full Set/DisFullSet/g" $conf/bacula-dir.conf > $tmp/1
91 mv $tmp/1 $conf/bacula-dir.conf
92
93 cat <<EOF > ${cwd}/tmp/bconcmds
94 @$out tmp/log12.out
95 reload
96 messages
97 @# should prune jobs using Full Set
98 list jobs
99 prune jobs yes
100 list jobs
101 EOF
102
103 run_bconsole
104
105 $bperl -e "check_prune_list('$tmp/log12.out', 1, 2, 3)"
106 estat=$(($estat + $?))
107
108 check_for_zombie_jobs storage=File
109 stop_bacula
110
111 touch $tmp/log2.out
112 check_two_logs
113
114 end_test