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