From: Martin Schwenke Date: Wed, 6 Jul 2016 04:06:14 +0000 (+1000) Subject: ctdb-tests: Add reclock event script tests X-Git-Tag: tdb-1.3.10~286 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c7a730cbc40f2fb81968e0e8fa44d441d825eb7f;p=thirdparty%2Fsamba.git ctdb-tests: Add reclock event script tests Tweak eventscript unit test infrastructure to support. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/eventscripts/01.reclock.monitor.001.sh b/ctdb/tests/eventscripts/01.reclock.monitor.001.sh new file mode 100755 index 00000000000..8230528c3fe --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.monitor.001.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "unset, check no-op" + +CTDB_RECOVERY_LOCK="" + +ok_null +simple_test diff --git a/ctdb/tests/eventscripts/01.reclock.monitor.002.sh b/ctdb/tests/eventscripts/01.reclock.monitor.002.sh new file mode 100755 index 00000000000..b40213f3256 --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.monitor.002.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "set to helper, check no-op" + +CTDB_RECOVERY_LOCK="!/some/recover/lock/helper foo" + +ok_null +simple_test diff --git a/ctdb/tests/eventscripts/01.reclock.monitor.003.sh b/ctdb/tests/eventscripts/01.reclock.monitor.003.sh new file mode 100755 index 00000000000..2d82a21d1ee --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.monitor.003.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "set, exists" + +setup_reclock + +ok_null +simple_test diff --git a/ctdb/tests/eventscripts/01.reclock.monitor.004.sh b/ctdb/tests/eventscripts/01.reclock.monitor.004.sh new file mode 100755 index 00000000000..fd185d1aa52 --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.monitor.004.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "set, doesn't exist, 4 times" + +setup_reclock +rm -f "$CTDB_RECOVERY_LOCK" + +ok_null +simple_test +simple_test +simple_test + +required_result 1 <" + echo "usage: df [-kP] []" exit 1 } -if [ "$1" != "-kP" ] ; then - usage +if [ "$1" = "-kP" ] ; then + shift fi -shift -if [ -z "$1" ] ; then - usage -fi +case "$1" in + -*) usage ;; +esac -fs="$1" +fs="${1:-/}" # Anything starting with CTDB_DBDIR gets canonicalised to CTDB_DBDIR. # This helps with the setting of defaults for the filesystem checks.