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