ctdb-tests: Add cluster.bash include file
authorMartin Schwenke <martin@meltin.net>
Wed, 11 Sep 2019 05:44:20 +0000 (15:44 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 4 Oct 2019 09:41:28 +0000 (09:41 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/UNIT/shellcheck/tests.sh
ctdb/tests/scripts/cluster.bash [new file with mode: 0755]
ctdb/wscript

index 1877f629dcac83344fa7ae597e30f8a887e42969..088e15c5368ac66f57d70cda0a4490a299a4bc4a 100755 (executable)
@@ -24,5 +24,6 @@ shellcheck_test -s sh \
        "${TEST_SCRIPTS_DIR}/script_install_paths.sh"
 
 shellcheck_test -s bash \
+       "${TEST_SCRIPTS_DIR}/cluster.bash" \
        "${TEST_SCRIPTS_DIR}/integration_local_daemons.bash" \
        "${TEST_SCRIPTS_DIR}/integration_real_cluster.bash"
diff --git a/ctdb/tests/scripts/cluster.bash b/ctdb/tests/scripts/cluster.bash
new file mode 100755 (executable)
index 0000000..916fc84
--- /dev/null
@@ -0,0 +1,18 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+. "${TEST_SCRIPTS_DIR}/integration.bash"
+
+if ! ctdb_test_on_cluster ; then
+       # Do not run on local daemons
+       ctdb_test_error \
+               "ERROR: This test must be run against a real/virtual cluster"
+fi
+
+h=$(hostname)
+
+for i in $(onnode -q all hostname) ; do
+       if [ "$h" = "$i" ] ; then
+               ctdb_test_error \
+                       "ERROR: This test must not be run from a cluster node"
+       fi
+done
index 2c09fe6ea5eb04840e69037c9f044a2cc9000b70..05137c64fdd1cf443bbb1ac4600bfc4b6aca837f 100644 (file)
@@ -1067,6 +1067,7 @@ def build(bld):
 
     # Install tests/scripts directory, excluding files that need munging
     test_scripts = [
+        'cluster.bash',
         'common.sh',
         'integration.bash',
         'integration_local_daemons.bash',