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