ctdb-tests: Run transaction tests with externally imposed timeout
[Samba.git] / ctdb / tests / simple / 53_ctdb_transaction.sh
blobaa9202fc90a0babe159f248eee9435da05d45b72
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that the ctdb_transaction test succeeds.
8 Prerequisites:
10 * An active CTDB cluster with at least 2 active nodes.
12 Steps:
14 1. Verify that the status on all of the ctdb nodes is 'OK'.
15 2. Run two copies of ctdb_transaction on each node with a 30 second
16 timeout.
17 3. Ensure that all ctdb_transaction processes complete successfully.
19 Expected results:
21 * ctdb_transaction runs without error.
22 EOF
25 . "${TEST_SCRIPTS_DIR}/integration.bash"
27 ctdb_test_init "$@"
29 set -e
31 cluster_is_healthy
33 try_command_on_node 0 "$CTDB listnodes"
34 num_nodes=$(echo "$out" | wc -l)
36 if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then
37 CTDB_TEST_TIMELIMIT=30
40 # Add a timeout command to ensure this test completes if
41 # ctdb_transaction gets stuck
42 timeout_cmd="timeout $((CTDB_TEST_TIMELIMIT * 2))"
44 t="$CTDB_TEST_WRAPPER $VALGRIND $timeout_cmd ctdb_transaction --timelimit=${CTDB_TEST_TIMELIMIT}"
46 echo "Running ctdb_transaction on all $num_nodes nodes."
47 try_command_on_node -v -p all "$t & $t"