Revert "ctdb-tests: Update preamble for INTEGRATION tests"
[Samba.git] / ctdb / tests / INTEGRATION / simple / cluster.020.message_ring.sh
blob6f90c8fd5bb908ab0689dc2cc23c979d95205924
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Run the message_ring test and sanity check the output.
8 Prerequisites:
10 * An active CTDB cluster with at least 2 active nodes.
11 EOF
14 . "${TEST_SCRIPTS_DIR}/integration.bash"
16 ctdb_test_init
18 set -e
20 cluster_is_healthy
22 try_command_on_node 0 "$CTDB listnodes | wc -l"
23 num_nodes="$out"
25 echo "Running message_ring on all $num_nodes nodes."
26 try_command_on_node -v -p all $CTDB_TEST_WRAPPER $VALGRIND message_ring -n $num_nodes
28 # Get the last line of output.
29 last=$(tail -n 1 "$outfile")
31 pat='^(Waiting for cluster|Ring\[[[:digit:]]+\]: [[:digit:]]+(\.[[:digit:]]+)? msgs/sec \(\+ve=[[:digit:]]+ -ve=[[:digit:]]+\))$'
32 sanity_check_output 1 "$pat"
34 # $last should look like this:
35 # Ring[1]: 10670.93 msgs/sec (+ve=53391 -ve=53373)
36 stuff="${last##Ring\[*\]: }"
37 mps="${stuff% msgs/sec*}"
39 if [ ${mps%.*} -ge 10 ] ; then
40 echo "OK: $mps msgs/sec >= 10 msgs/sec"
41 else
42 echo "BAD: $mps msgs/sec < 10 msgs/sec"
43 exit 1
46 stuff="${stuff#*msgs/sec (+ve=}"
47 positive="${stuff%% *}"
49 if [ $positive -ge 10 ] ; then
50 echo "OK: +ive ($positive) >= 10"
51 else
52 echo "BAD: +ive ($positive) < 10"
53 exit 1
56 stuff="${stuff#*-ve=}"
57 negative="${stuff%)}"
59 if [ $negative -ge 10 ] ; then
60 echo "OK: -ive ($negative) >= 10"
61 else
62 echo "BAD: -ive ($negative) < 10"
63 exit 1