From: Martin Schwenke Date: Mon, 8 Jul 2019 06:37:41 +0000 (+1000) Subject: ctdb-tests: Add some 01.reclock.script init event tests X-Git-Tag: tdb-1.4.2~399 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5701f4aecafcd4efeba5bc12ace5da3101ea49d9;p=thirdparty%2Fsamba.git ctdb-tests: Add some 01.reclock.script init event tests Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/eventscripts/01.reclock.init.001.sh b/ctdb/tests/eventscripts/01.reclock.init.001.sh new file mode 100755 index 00000000000..c495a47960e --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.init.001.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "unset, check no-op" + +setup "" + +ok_null +simple_test diff --git a/ctdb/tests/eventscripts/01.reclock.init.002.sh b/ctdb/tests/eventscripts/01.reclock.init.002.sh new file mode 100755 index 00000000000..1bd409ca96c --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.init.002.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "set to use helper, check no-op" + +setup "!/bin/false" + +ok_null +simple_test diff --git a/ctdb/tests/eventscripts/01.reclock.init.003.sh b/ctdb/tests/eventscripts/01.reclock.init.003.sh new file mode 100755 index 00000000000..85f1f3c6f80 --- /dev/null +++ b/ctdb/tests/eventscripts/01.reclock.init.003.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +define_test "set to default lock file, directory is created" + +setup + +dir=$(dirname "$CTDB_RECOVERY_LOCK") + +# Ensure directory doesn't exist before +required_result 1 "" +unit_test test -d "$dir" + +# FreeBSD mkdir -v just prints the filename. Filter the rest of the +# message from other platforms, including any exotic quotes around the +# filename. +result_filter () +{ + sed \ + -e 's|^\(mkdir: created directory \)[[:punct:]]||' \ + -e 's|[[:punct:]]$||' +} + +ok "$dir" +simple_test + +# Ensure directory exists after +ok_null +unit_test test -d "$dir"