]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/reload-client-address-test
regress: Add checks for Enabled flag
[bacula/bacula] / regress / tests / reload-client-address-test
1 #!/bin/sh
2 #
3 TestName="reload-client-address-test"
4 JobName=backup
5 . scripts/functions
6
7 scripts/cleanup
8 scripts/copy-confs
9
10 #
11 # Zap out any schedule in default conf file so that
12 #  it doesn't start during our test
13 #
14 outf="$tmp/sed_tmp"
15 echo "s%  Schedule =%# Schedule =%g" >${outf}
16 cp $scripts/bacula-dir.conf $tmp/1
17 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
18
19 change_jobname BackupClient1 $JobName
20 start_test
21
22 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Address", "127.0.0.1", "Client")'
23 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Enabled", "yes", "Client")'
24
25 cat <<END_OF_DATA >$tmp/bconcmds
26 @$out /dev/null
27 messages
28 @$out $tmp/log0.out
29 show client
30 @$out $tmp/log1.out
31 run job=$JobName yes
32 wait
33 messages
34 quit
35 END_OF_DATA
36
37 run_bacula
38
39 print_debug "Changing 127.0.0.1 to 127.0.0.2 for the Client"
40 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Address", "127.0.0.2", "Client")'
41
42 cat <<END_OF_DATA >$tmp/bconcmds
43 @$out $tmp/log2.out
44 reload
45 messages
46 show client
47 quit
48 END_OF_DATA
49
50 run_bconsole
51
52 print_debug "Disable client"
53
54 client=`awk '/Name=/ { gsub(/Name=/, "", $2); print $2; exit }' $tmp/log0.out`
55
56 cat <<END_OF_DATA >$tmp/bconcmds
57 @$out $tmp/log3.out
58 disable client=$client
59 show client
60 @$out $tmp/log4.out
61 reload
62 show client
63 @$out $tmp/log5.out
64 enable client=$client
65 reload
66 show client
67 quit
68 END_OF_DATA
69
70 run_bconsole
71
72 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Enabled", "no", "Client")'
73
74 cat <<END_OF_DATA >$tmp/bconcmds
75 @$out $tmp/log6.out
76 reload
77 show client
78 @$out $tmp/log7.out
79 enabled client=$client
80 reload
81 show client
82 quit
83 END_OF_DATA
84
85 grep "127.0.0.1" $tmp/log0.out > /dev/null
86 if [ $? -ne 0 ]; then
87     print_debug "ERROR: Should find 127.0.0.1 in $tmp/log0.out"
88     estat=1
89 fi
90
91 grep "127.0.0.2" $tmp/log2.out > /dev/null
92 if [ $? -ne 0 ]; then
93     print_debug "ERROR: Should find 127.0.0.2 in $tmp/log2.out"
94     estat=1
95 fi
96
97 grep "127.0.0.2" $tmp/log3.out > /dev/null
98 if [ $? -ne 0 ]; then
99     print_debug "ERROR: Should find 127.0.0.2 in $tmp/log3.out"
100     estat=1
101 fi
102
103 grep "Enabled=0" $tmp/log3.out > /dev/null
104 if [ $? -ne 0 ]; then
105     print_debug "ERROR: Should find Enabled=0 in $tmp/log3.out"
106     estat=1
107 fi
108
109 grep "Enabled=0" $tmp/log4.out > /dev/null
110 if [ $? -ne 0 ]; then
111     print_debug "ERROR: Should find Enabled=0 in $tmp/log4.out"
112     estat=1
113 fi
114
115 grep "Enabled=1" $tmp/log5.out > /dev/null
116 if [ $? -ne 0 ]; then
117     print_debug "ERROR: Should find Enabled=1 in $tmp/log5.out"
118     estat=1
119 fi
120
121 stop_bacula
122
123 end_test