]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/maxbw-test
Add restore replace=never test ticket 2317
[bacula/bacula] / regress / tests / maxbw-test
1 #!/bin/sh
2 #
3 # Verify Maximum Bandwidth FD parameter
4 #
5
6 TestName="maxbw-test"
7 JobName=NightlySave
8 . scripts/functions
9
10 scripts/cleanup
11 scripts/copy-test-confs
12
13 $bperl -e 'add_attribute("$conf/bacula-fd.conf", "MaximumBandwidthPerJob", "3MB/s", "FileDaemon")'
14
15 echo $cwd/build > $tmp/file-list
16
17 start_test
18
19 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
20 @$out /dev/null
21 messages
22 @$out ${cwd}/tmp/log1.out
23 label storage=File volume=TestVolume001
24 run level=full job=$JobName yes
25 wait
26 messages
27 quit
28 END_OF_DATA
29
30 run_bacula
31
32 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
33 @# 
34 @# now do a restore
35 @#
36 @$out ${cwd}/tmp/log2.out
37 restore where=$tmp select all done
38 yes
39 wait
40 messages
41 quit
42 END_OF_DATA
43
44 run_bconsole
45
46 stop_bacula
47
48 awk '/Rate:/ { if ($2 > 2500 && $2 < 3500) { print "OK" } 
49                else { print "ERROR" }}' $tmp/log1.out > $tmp/res
50
51 awk '/Rate:/ { if ($2 > 2500 && $2 < 3500) { print "OK" } 
52                else { print "ERROR" }}' $tmp/log2.out >> $tmp/res
53
54 a=`grep OK $tmp/res | wc -l`
55 if [ $a -ne 2 ]; then
56     print_debug "ERROR: problem with backup or restore speed on bacula-fd.conf"
57 fi
58
59 sed -i 's/MaximumBandwidth.*//g' $conf/bacula-fd.conf
60
61 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaximumBandwidth", "3MB/s", "Job", "$JobName")'
62
63 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
64 @$out /dev/null
65 messages
66 @$out ${cwd}/tmp/log1.out
67 run level=full job=$JobName yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72
73 run_bacula
74
75 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
76 @# 
77 @# now do a restore
78 @#
79 @$out ${cwd}/tmp/log2.out
80 restore where=$tmp select all done
81 yes
82 wait
83 messages
84 quit
85 END_OF_DATA
86
87 run_bconsole
88
89 stop_bacula
90
91 check_two_logs
92
93 awk '/Rate:/ { if ($2 > 2500 && $2 < 3500) { print "OK" } 
94                else { print "ERROR" }}' $tmp/log1.out > $tmp/res
95
96 awk '/Rate:/ { if ($2 > 2500 && $2 < 3500) { print "OK" } 
97                else { print "ERROR" }}' $tmp/log2.out >> $tmp/res
98
99 a=`grep OK $tmp/res | wc -l`
100 if [ $a -ne 3 ]; then
101     print_debug "ERROR: problem with backup or restore speed on bacula-dir.conf"
102 fi
103
104 end_test