From f4871b8736f22941b227c19656319033c0c812e8 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Wed, 8 Oct 2014 12:22:06 +1100 Subject: [PATCH] ctdb-tests: Run transaction tests with externally imposed timeout This works around cases where ctdb_transaction gets stuck - this still needs to be debugged. However, this change will at least cause individual tests to fail rather than having whole test runs time out. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/simple/53_ctdb_transaction.sh | 10 +++++++--- ctdb/tests/simple/54_ctdb_transaction_recovery.sh | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ctdb/tests/simple/53_ctdb_transaction.sh b/ctdb/tests/simple/53_ctdb_transaction.sh index be4a98e4296..aa9202fc90a 100755 --- a/ctdb/tests/simple/53_ctdb_transaction.sh +++ b/ctdb/tests/simple/53_ctdb_transaction.sh @@ -33,11 +33,15 @@ cluster_is_healthy try_command_on_node 0 "$CTDB listnodes" num_nodes=$(echo "$out" | wc -l) -if test "x${CTDB_TEST_TIMELIMIT}" == "x" ; then - CTDB_TEST_TIMELIMIT=30 +if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then + CTDB_TEST_TIMELIMIT=30 fi -t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}" +# Add a timeout command to ensure this test completes if +# ctdb_transaction gets stuck +timeout_cmd="timeout $((CTDB_TEST_TIMELIMIT * 2))" + +t="$CTDB_TEST_WRAPPER $VALGRIND $timeout_cmd ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}" echo "Running ctdb_transaction on all $num_nodes nodes." try_command_on_node -v -p all "$t & $t" diff --git a/ctdb/tests/simple/54_ctdb_transaction_recovery.sh b/ctdb/tests/simple/54_ctdb_transaction_recovery.sh index acd92244c58..78a6e992f5d 100755 --- a/ctdb/tests/simple/54_ctdb_transaction_recovery.sh +++ b/ctdb/tests/simple/54_ctdb_transaction_recovery.sh @@ -52,11 +52,17 @@ cluster_is_healthy try_command_on_node 0 "$CTDB listnodes" num_nodes=$(echo "$out" | wc -l) -if test "x${CTDB_TEST_TIMELIMIT}" == "x" ; then - CTDB_TEST_TIMELIMIT=30 +if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then + CTDB_TEST_TIMELIMIT=30 fi -t="$CTDB_TEST_WRAPPER $VALGRIND ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}" +# Add a timeout command to ensure this test completes if +# ctdb_transaction gets stuck. This one can get more "stuck" than the +# previous test because a recovery can stop it committing a +# transaction. +timeout_cmd="timeout 600" + +t="$CTDB_TEST_WRAPPER $VALGRIND $timeout_cmd ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}" echo "Starting recovery loop" recovery_loop_start -- 2.11.4.GIT