c98b139e9ccdacf9947ce82666a4f1fa7bacfe16
[vlendec/samba-autobuild/.git] / ctdb / tests / simple / 81_tunnel_ring.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Run tunnel_test and sanity check the output.
7
8 Prerequisites:
9
10 * An active CTDB cluster with at least 2 active nodes.
11 EOF
12 }
13
14 . "${TEST_SCRIPTS_DIR}/integration.bash"
15
16 ctdb_test_init "$@"
17
18 set -e
19
20 cluster_is_healthy
21
22 try_command_on_node 0 "$CTDB listnodes"
23 num_nodes=$(echo "$out" | wc -l)
24
25 echo "Running tunnel_test on all $num_nodes nodes."
26 try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND \
27         tunnel_test -t 30 -n $num_nodes
28
29 # Get the last line of output.
30 while read line ; do
31     prev=$line
32 done <<<"$out"
33
34 pat='^(Waiting for cluster|pnn\[[[:digit:]]+\] [[:digit:]]+(\.[[:digit:]]+)? msgs/sec)$'
35 sanity_check_output 1 "$pat" "$out"
36
37 # $prev should look like this:
38 #    pnn[2] count=85400
39 stuff="${prev##pnn\[*\] }"
40 mps="${stuff% msgs/sec}"
41
42 if [ ${mps%.*} -ge 10 ] ; then
43     echo "OK: $mps msgs/sec >= 10 msgs/sec"
44 else
45     echo "BAD: $mps msgs/sec < 10 msgs/sec"
46     exit 1
47 fi