3 # Run a couple of tests with bconsole
5 TestName="bconsole-test"
10 scripts/copy-test-confs
13 # Zap out any schedule in default conf file so that
14 # it doesn't start during our test
17 echo "s% Schedule =%# Schedule =%g" >${outf}
18 cp $scripts/bacula-dir.conf $tmp/1
19 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
21 change_jobname BackupClient1 $JobName
28 print_debug "Test bconsole -l and -D with a single director definition"
30 $bin/bconsole -c $conf/bconsole.conf -l > $tmp/1
32 print_debug "Bconsole doesn't support -l option"
36 nb=`cat $tmp/1 | wc -l`
37 if [ "$nb" -ne 1 ]; then
38 print_debug "Found more than one director in bconsole -l output"
42 grep "$HOST-dir" $tmp/1 > /dev/null
44 print_debug "bconsole -l option doesn't display $HOST-dir"
48 echo quit | $bin/bconsole -c $conf/bconsole.conf -D "this is a test" > $tmp/1
50 print_debug "Bconsole should abort if selected directors isn't defined"
54 echo quit | $bin/bconsole -c $conf/bconsole.conf -D "$HOST-dir" > $tmp/1
56 print_debug "bconsole doesn't connect to $HOST-dir"
60 perl -Mscripts::functions \
61 -e "extract_resource('$conf/bconsole.conf', 'Director', '$HOST-dir')" \
64 sed "s/$HOST-dir/bconsole-test-dir/" $tmp/1 >> $conf/bconsole.conf
66 $bin/bconsole -t -c $conf/bconsole.conf > $tmp/1
68 print_debug "configuration tweak failed"
72 $bin/bconsole -c $conf/bconsole.conf -l > $tmp/1
74 print_debug "Bconsole doesn't support -l option"
78 nb=`cat $tmp/1 | wc -l`
79 if [ "$nb" -ne 2 ]; then
80 print_debug "Found more than one director in bconsole -l output"
84 grep "$HOST-dir" $tmp/1 > /dev/null
86 print_debug "bconsole -l option doesn't display $HOST-dir"
90 grep "bconsole-test-dir" $tmp/1 > /dev/null
92 print_debug "bconsole -l option doesn't display bconsole-test-dir"
96 echo quit | $bin/bconsole -c $conf/bconsole.conf -D "this is a test" > $tmp/1
98 print_debug "Bconsole should abort if selected directors isn't defined"
102 echo quit | $bin/bconsole -c $conf/bconsole.conf -D "$HOST-dir" > $tmp/1
103 if [ $? -ne 0 ]; then
104 print_debug "bconsole doesn't connect to $HOST-dir"
108 echo quit | $bin/bconsole -c $conf/bconsole.conf -D "bconsole-test-dir" > $tmp/1
109 if [ $? -ne 0 ]; then
110 print_debug "bconsole doesn't connect to bconsole-test-dir"