From: Martin Schwenke Date: Wed, 2 Oct 2019 05:08:18 +0000 (+1000) Subject: ctdb-tests: Add function ctdb_test_on_cluster() X-Git-Tag: talloc-2.3.1~496 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59055f4da1ac4747c771a8acf2392b5e4599679b;p=thirdparty%2Fsamba.git ctdb-tests: Add function ctdb_test_on_cluster() This centralises this logic. Use it in a subset of tests - there are other cases but these will be cleaned up soon. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh b/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh index d9fdd28f775..d8e0097362f 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.001.list.sh @@ -43,7 +43,7 @@ machineout=$(sed -r \ -e 's@\]@@g' \ "$outfile") -if [ -z "$TEST_LOCAL_DAEMONS" ]; then +if ctdb_test_on_cluster ; then while read ip pnn ; do try_command_on_node $pnn "ip addr show to ${ip}" if [ -n "$out" ] ; then diff --git a/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh b/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh index 5b11f9f3885..c455784c886 100755 --- a/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh +++ b/ctdb/tests/INTEGRATION/failover/pubips.050.missing_ip.sh @@ -35,7 +35,7 @@ try_command_on_node -v all $CTDB ip my_exit_hook () { - if [ -z "$TEST_LOCAL_DAEMONS" ] ; then + if ctdb_test_on_cluster ; then onnode -q all $CTDB event script enable legacy "10.interface" fi } @@ -50,7 +50,7 @@ try_command_on_node $test_node $CTDB sync # in the middle of a monitor event and will have the expected effect. wait_for_monitor_event $test_node -if [ -z "$TEST_LOCAL_DAEMONS" ] ; then +if ctdb_test_on_cluster ; then # Stop monitor events from bringing up the link status of an interface try_command_on_node $test_node $CTDB event script disable legacy 10.interface fi diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index 9142cf5701c..c8a1b760835 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -23,6 +23,11 @@ PATH="${TEST_SCRIPTS_DIR}:${PATH}" ###################################################################### +ctdb_test_on_cluster () +{ + [ -z "$TEST_LOCAL_DAEMONS" ] +} + ctdb_test_exit () { local status=$? @@ -217,7 +222,7 @@ get_test_ip_mask_and_iface () try_command_on_node $test_node "$CTDB ip -v -X | awk -F'|' -v ip=$test_ip '\$2 == ip { print \$4 }'" iface="$out" - if [ -z "$TEST_LOCAL_DAEMONS" ] ; then + if ctdb_test_on_cluster ; then # Find the netmask try_command_on_node $test_node ip addr show to $test_ip mask="${out##*/}" @@ -662,7 +667,7 @@ db_ctdb_tstore_dbseqnum () # Make sure that $CTDB is set. : ${CTDB:=ctdb} -if [ -z "$TEST_LOCAL_DAEMONS" ] ; then +if ctdb_test_on_cluster ; then . "${TEST_SCRIPTS_DIR}/integration_real_cluster.bash" else . "${TEST_SCRIPTS_DIR}/integration_local_daemons.bash"