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