pgpool2.git / summary / log / commit / refs

commit    459da379db237f70e53f4681fbe7534c6eea699f
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Tue Jul 23 04:36:37 2013 +0000

    Add watchdog test.
    
    Currently the test is minimum. It just checks standby->master
    escalation.


test/regression/tests/004.watchdog/master.conf | 12 ++++++ test/regression/tests/004.watchdog/standby.conf | 19 +++++++++ test/regression/tests/004.watchdog/test.sh | 52 +++++++++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/test/regression/tests/004.watchdog/master.conf b/test/regression/tests/004.watchdog/master.conf new file mode 100644 index 000000000..900fc0878 --- /dev/null +++ b/test/regression/tests/004.watchdog/master.conf @@ -0,0 +1,12 @@ +# master watchdog +use_watchdog = on +wd_hostname = 'localhost' +wd_port = 11004 +wd_heartbeat_port = 11005 +heartbeat_destination0 = 'localhost' +heartbeat_destination_port0 = 11005 +heartbeat_destination1 = 'localhost' +heartbeat_destination_port1 = 11105 +other_pgpool_hostname1 = 'localhost' +other_pgpool_port1 = 11102 +other_wd_port1 = 11104 diff --git a/test/regression/tests/004.watchdog/standby.conf b/test/regression/tests/004.watchdog/standby.conf new file mode 100644 index 000000000..c653883a9 --- /dev/null +++ b/test/regression/tests/004.watchdog/standby.conf @@ -0,0 +1,19 @@ +# standby watchdog +use_watchdog = on +wd_hostname = 'localhost' +wd_port = 11104 +wd_heartbeat_port = 11105 +heartbeat_destination0 = 'localhost' +heartbeat_destination_port0 = 11105 +heartbeat_destination1 = 'localhost' +heartbeat_destination_port1 = 11005 +other_pgpool_hostname1 = 'localhost' +other_pgpool_port1 = 11002 +other_wd_port1 = 11004 + +backend_hostname0 = '' +backend_port0 = 11000 +backend_weight0 = 1 +backend_hostname1 = '' +backend_port1 = 11001 +backend_weight1 = 1 diff --git a/test/regression/tests/004.watchdog/test.sh b/test/regression/tests/004.watchdog/test.sh new file mode 100755 index 000000000..11b2255e6 --- /dev/null +++ b/test/regression/tests/004.watchdog/test.sh @@ -0,0 +1,52 @@ +#! /bin/sh -x +#------------------------------------------------------------------- +# test script for watchdog +source $TESTLIBS +TESTDIR=master + +rm -fr $TESTDIR +mkdir $TESTDIR +cd $TESTDIR + +# create master environment +echo -n "creating master pgpool..." +sh $PGPOOL_SETUP -m s -n 2 -p 11000|| exit 1 +echo "done." +cat ../master.conf >> etc/pgpool.conf + +./startall +wait_for_pgpool_startup + +cd .. + +# create standby environment +sdir=standby +rm -fr $sdir +mkdir $sdir +cd $sdir +echo -n "creating standby pgpool..." +sh $PGPOOL_SETUP -m s -n 2 -p 11100|| exit 1 +echo "done." +cat ../standby.conf >> etc/pgpool.conf +egrep 'backend_data_directory0|backend_data_directory1|failover_command|follow_master_command' ../$TESTDIR/etc/pgpool.conf >> etc/pgpool.conf +./startall +wait_for_pgpool_startup +cd .. + +# stop master pgpool and see if standby take over +pgpool -f master/etc/pgpool.conf -m f stop + +sleep 1 + +RESULT=`grep "wd_escalation: escalated to master pgpool successfully" standby/log/pgpool.log` + +cd master +./shutdownall +cd ../standby +./shutdownall + +if [ $RESULT = '' ]; then + exit 1 +fi + +exit 0 [parent: 9ddf1de712d5]