ctdb-tests: Only set TEST_SUBDIR when needed
authorMartin Schwenke <martin@meltin.net>
Thu, 5 Sep 2019 05:51:08 +0000 (15:51 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 17 Sep 2019 04:35:26 +0000 (04:35 +0000)
This is only needed for setup_ctdb_base() so only set it when calling
this function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/local_daemons.sh

index 4934783ff9a863ab6956670e84897a870e174876..15c80713b3b32d4412bc097852344f07a4f01b90 100755 (executable)
@@ -13,14 +13,6 @@ export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
 
 . "${TEST_SCRIPTS_DIR}/common.sh"
 
-# common.sh will set TEST_SUBDIR to a stupid value when installed
-# because common.sh is usually sourced by a test.  TEST_SUBDIR needs
-# to be correctly set so setup_ctdb_base() finds the etc-ctdb/
-# subdirectory and the test event script is correctly installed, so
-# fix it.
-# shellcheck disable=SC2034
-TEST_SUBDIR="$CTDB_TEST_DIR"
-
 if ! $CTDB_TESTS_ARE_INSTALLED ; then
        hdir="$CTDB_SCRIPTS_HELPER_BINDIR"
        export CTDB_EVENTD="${hdir}/ctdb-eventd"
@@ -205,7 +197,15 @@ local_daemons_setup ()
        fi
 
        for _n in $(seq 0 $((_num_nodes - 1))) ; do
-               setup_ctdb_base "$directory" "node.${_n}" \
+               # common.sh will set TEST_SUBDIR to a stupid value
+               # when installed because common.sh is usually sourced
+               # by a test.  TEST_SUBDIR needs to be correctly set so
+               # setup_ctdb_base() finds the etc-ctdb/ subdirectory
+               # and the test event script is correctly installed, so
+               # fix it.
+               # shellcheck disable=SC2034
+               TEST_SUBDIR="$CTDB_TEST_DIR" \
+                          setup_ctdb_base "$directory" "node.${_n}" \
                                functions notify.sh debug-hung-script.sh
 
                cp "$_nodes_all" "${CTDB_BASE}/nodes"