]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Add some 01.reclock.script init event tests
authorMartin Schwenke <martin@meltin.net>
Mon, 8 Jul 2019 06:37:41 +0000 (16:37 +1000)
committerMartin Schwenke <martins@samba.org>
Fri, 26 Jul 2019 03:34:17 +0000 (03:34 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/01.reclock.init.001.sh [new file with mode: 0755]
ctdb/tests/eventscripts/01.reclock.init.002.sh [new file with mode: 0755]
ctdb/tests/eventscripts/01.reclock.init.003.sh [new file with mode: 0755]

diff --git a/ctdb/tests/eventscripts/01.reclock.init.001.sh b/ctdb/tests/eventscripts/01.reclock.init.001.sh
new file mode 100755 (executable)
index 0000000..c495a47
--- /dev/null
@@ -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 (executable)
index 0000000..1bd409c
--- /dev/null
@@ -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 (executable)
index 0000000..85f1f3c
--- /dev/null
@@ -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"