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