docs:smbdotconf: fix type of "preferred master" parameter.
[Samba.git] / ctdb / tests / simple / 15_ctdb_statisticsreset.sh
blobeaa60d692052e07f166d60129170498209890971
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that 'ctdb statisticsreset' works as expected.
8 This is pretty superficial. It just checks that a few particular
9 items reduce.
11 Prerequisites:
13 * An active CTDB cluster with at least 2 active nodes.
15 Steps:
17 1. Verify that the status on all of the ctdb nodes is 'OK'.
18 2. Run 'ctdb statisticsreset' on all nodes and verify that it executes
19 successfully.
21 Expected results:
23 * 'ctdb statisticsreset' executes successfully.
24 EOF
27 . "${TEST_SCRIPTS_DIR}/integration.bash"
29 ctdb_test_init "$@"
31 set -e
33 cluster_is_healthy
35 try_command_on_node 0 "$CTDB listnodes | wc -l"
36 num_nodes="$out"
38 get_stat ()
40 local label="$1"
41 local out="$2"
43 echo "$out" | sed -rn -e "s@^[[:space:]]+${label}[[:space:]]+([[:digit:]])@\1@p" | head -1
46 check_reduced ()
48 local label="$1"
49 local before="$2"
50 local after="$3"
52 if [ $after -lt $before ] ; then
53 echo "GOOD: ${label} reduced from ${before} to ${after}"
54 else
55 echo "BAD: ${label} did not reduce from ${before} to ${after}"
56 testfailures=1
60 n=0
61 while [ $n -lt $num_nodes ] ; do
62 echo "Getting initial statistics for node ${n}..."
64 try_command_on_node -v $n $CTDB statistics
66 before_req_control=$(get_stat "req_control" "$out")
67 before_reply_control=$(get_stat "reply_control" "$out")
68 before_node_packets_recv=$(get_stat "node_packets_recv" "$out")
70 try_command_on_node $n $CTDB statisticsreset
72 try_command_on_node -v $n $CTDB statistics
74 after_req_control=$(get_stat "req_control" "$out")
75 after_reply_control=$(get_stat "reply_control" "$out")
76 after_node_packets_recv=$(get_stat "node_packets_recv" "$out")
78 check_reduced "req_control" "$before_req_control" "$after_req_control"
79 check_reduced "reply_control" "$before_reply_control" "$after_reply_control"
80 check_reduced "node_packets_recv" "$before_node_packets_recv" "$after_node_packets_recv"
82 n=$(($n + 1))
83 done