ctdb-tests: Drop passing of test arguments to ctdb_test_init()
[vlendec/samba-autobuild/.git] / ctdb / tests / simple / 54_transaction_loop_recovery.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify that the transaction_loop test succeeds with recoveries.
7
8 Prerequisites:
9
10 * An active CTDB cluster with at least 2 active nodes.
11 EOF
12 }
13
14 recovery_loop()
15 {
16         local COUNT=1
17
18         while true ; do
19                 echo Recovery $COUNT
20                 try_command_on_node 0 $CTDB recover
21                 sleep 2
22                 COUNT=$((COUNT + 1))
23         done
24 }
25
26 recovery_loop_start()
27 {
28         recovery_loop >/dev/null &
29         RECLOOP_PID=$!
30         ctdb_test_exit_hook_add "kill $RECLOOP_PID >/dev/null 2>&1"
31 }
32
33 . "${TEST_SCRIPTS_DIR}/integration.bash"
34
35 ctdb_test_init
36
37 set -e
38
39 cluster_is_healthy
40
41 TESTDB="persistent_trans.tdb"
42
43 try_command_on_node 0 "$CTDB attach $TESTDB persistent"
44 try_command_on_node 0 "$CTDB wipedb $TESTDB"
45
46 try_command_on_node 0 "$CTDB listnodes"
47 num_nodes=$(echo "$out" | wc -l)
48
49 if [ -z "$CTDB_TEST_TIMELIMIT" ] ; then
50     CTDB_TEST_TIMELIMIT=30
51 fi
52
53 t="$CTDB_TEST_WRAPPER $VALGRIND transaction_loop \
54         -n ${num_nodes} -t ${CTDB_TEST_TIMELIMIT} \
55         -D ${TESTDB} -T persistent -k testkey"
56
57 echo "Starting recovery loop"
58 recovery_loop_start
59
60 echo "Running transaction_loop on all $num_nodes nodes."
61 try_command_on_node -v -p all "$t"