summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-10-08 12:22:06 +1100
committerAmitay Isaacs <amitay@samba.org>2015-07-01 04:18:28 +0200
commitf4871b8736f22941b227c19656319033c0c812e8 (patch)
tree8d3467716473b956c55d2941effbdf82a365ac01 /ctdb
parente1a87d86764d0c677b69c7d7a99c5388d4e85570 (diff)
downloadsamba-f4871b8736f22941b227c19656319033c0c812e8.tar.gz
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 <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/tests/simple/53_ctdb_transaction.sh10
-rwxr-xr-xctdb/tests/simple/54_ctdb_transaction_recovery.sh12
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