From 7823a90ffb264f9aef75044bb2b1ff04d4a86a13 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 8 Dec 2009 16:14:45 +0100 Subject: [PATCH] Add test for reload command --- regress/tests/reload-test | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 regress/tests/reload-test diff --git a/regress/tests/reload-test b/regress/tests/reload-test new file mode 100755 index 0000000000..a49dc8b019 --- /dev/null +++ b/regress/tests/reload-test @@ -0,0 +1,123 @@ +#!/bin/sh +# +# test the reload and test command +# +TestName="reload-test" +. scripts/functions + +require_linux +scripts/cleanup +scripts/copy-confs + +bstat=0 +rstat=0 +zstat=0 + +detect_error() +{ + $bin/bacula-dir -t $conf/bacula-dir.conf 2>&1 >> $tmp/testconf.log + if [ $? = 0 ]; then + estat=1 + print_debug "Should detect error on bacula-dir.conf" + fi +} + +do_reload() +{ + cat > $tmp/bcons <&1 >>$tmp/reload.log + + ps $pid > /dev/null + if [ $? != 0 ]; then + estat=1 + print_debug "Bacula shouldn't die with a reload" + fi + + ls -l /proc/$pid/fd | grep bacula-dir.conf + if [ $? = 0 ]; then + estat=1 + print_debug "Should not have bacula-dir.conf open" + fi +} + +start_test + +# should be ok +$bin/bacula-dir -t $conf/bacula-dir.conf +if [ $? != 0 ]; then + estat=1 + print_debug "Error on bacula-dir.conf" +fi + +$bin/bacula-ctl-dir start >/dev/null +pid=`cat $working/bacula-dir.$BASEPORT.pid` +read a +sleep 2 + +ls -l /proc/$pid/fd | grep bacula-dir.conf +if [ $? = 0 ]; then + estat=1 + print_debug "Should not have bacula-dir.conf open" +fi + +# should work well +do_reload + +# backup the configuration +cp $conf/bacula-dir.conf $tmp/1 +cat >> $conf/bacula-dir.conf<> $conf/bacula-dir.conf<> $conf/bacula-dir.conf<> $conf/bacula-dir.conf</dev/null + +end_test -- 2.39.5