From: Martin Schwenke Date: Mon, 11 Jun 2018 18:44:54 +0000 (+1000) Subject: ctdb-tests: Switch 90_debug_hung_script.sh to be a simple test X-Git-Tag: tevent-0.9.37~166 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ff181a82f2b5907b6d98768f72ff2769c358c2c3;p=thirdparty%2Fsamba.git ctdb-tests: Switch 90_debug_hung_script.sh to be a simple test This test only runs against local daemons. Configuration is done via script.options, which simplifies things quite a bit. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/complex/90_debug_hung_script.sh b/ctdb/tests/simple/90_debug_hung_script.sh similarity index 52% rename from ctdb/tests/complex/90_debug_hung_script.sh rename to ctdb/tests/simple/90_debug_hung_script.sh index 797f007e106..b605dc02fd4 100755 --- a/ctdb/tests/complex/90_debug_hung_script.sh +++ b/ctdb/tests/simple/90_debug_hung_script.sh @@ -21,46 +21,35 @@ set -e ctdb_test_init "$@" -ctdb_test_check_real_cluster - cluster_is_healthy -# No need for restart when done +if [ -z "$TEST_LOCAL_DAEMONS" ] ; then + echo "SKIPPING this test - only runs against local daemons" + exit 0 +fi + +# Reset configuration +ctdb_restart_when_done # This is overkill but it at least provides a valid test node select_test_node_and_ips #################### -# Set this if CTDB is installed in a non-standard location on cluster -# nodes -[ -n "$CTDB_BASE" ] || CTDB_BASE="/etc/ctdb" - -#################### - -echo "Enable eventscript for testing timeouts..." -ctdb_test_exit_hook_add "onnode -q $test_node $CTDB event script disable 99.timeout" -try_command_on_node $test_node $CTDB event script enable "99.timeout" - -#################### - echo "Setting monitor events to time out..." -rc_local_d="${CTDB_BASE}/rc.local.d" -try_command_on_node $test_node mkdir -p "$rc_local_d" +try_command_on_node $test_node 'echo $CTDB_BASE' +ctdb_base="$out" +script_options="${ctdb_base}/script.options" +ctdb_test_exit_hook_add "onnode $test_node rm -f $script_options" -rc_local_f="${rc_local_d}/timeout_config.$$" -ctdb_test_exit_hook_add "onnode $test_node rm -f $rc_local_f" - -try_command_on_node $test_node mktemp -debug_output="$out" +debug_output="${ctdb_base}/debug-hung-script.log" ctdb_test_exit_hook_add "onnode $test_node rm -f $debug_output" -try_command_on_node -i $test_node tee "$rc_local_f" <<<"\ +try_command_on_node -i $test_node tee "$script_options" <<<"\ CTDB_RUN_TIMEOUT_MONITOR=yes CTDB_DEBUG_HUNG_SCRIPT_LOGFILE=\"$debug_output\" -CTDB_DEBUG_HUNG_SCRIPT_STACKPAT='exportfs|rpcinfo|sleep'" - -try_command_on_node $test_node chmod +x "$rc_local_f" +CTDB_DEBUG_HUNG_SCRIPT_STACKPAT='exportfs|rpcinfo|sleep' +CTDB_SCRIPT_VARDIR=\"$CTDB_BASE\"" #################### @@ -75,20 +64,20 @@ try_command_on_node -v $test_node cat "$debug_output" while IFS="" read pattern ; do if grep -- "^${pattern}\$" <<<"$out" >/dev/null ; then - echo "GOOD: output contains \"$pattern\"" + printf 'GOOD: output contains "%s"\n' "$pattern" else - echo "BAD: output does not contain \"$pattern\"" + printf 'BAD: output does not contain "%s"\n' "$pattern" exit 1 fi -done <<'EOF' +done <] .*sleep+.* ---- ctdb scriptstatus monitor: ---- -99\\.timeout *TIMEDOUT.* - *OUTPUT: sleeping for [0-9]* seconds\\.\\.\\. +00\\.test *TIMEDOUT.* + *OUTPUT: Sleeping for [0-9]* seconds\\\\.\\\\.\\\\. EOF