smbd: Simplify validate_lock_entries
[Samba.git] / ctdb / tests / simple / 08_ctdb_isnotrecmaster.sh
blob138f59c6e793713a554f97009696ff03f7e69deb
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify the operation of 'ctdb isnotrecmaster'.
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 'ctdb isnotrecmaster' on each node.
17 3. Verify that only 1 node shows the output 'This node is the
18 recmaster' and all the other nodes show the output 'This node is
19 not the recmaster'.
21 Expected results:
23 * 'ctdb isnotrecmaster' shows the correct output.
24 EOF
27 . "${TEST_SCRIPTS_DIR}/integration.bash"
29 ctdb_test_init "$@"
31 set -e
33 cluster_is_healthy
35 cmd="$CTDB isnotrecmaster || true"
36 try_command_on_node all "$cmd"
37 echo "Output of \"$cmd\":"
38 echo "$out"
40 num_all_lines=$(echo "$out" | wc -l)
41 num_rm_lines=$(echo "$out" | fgrep -c 'this node is the recmaster') || true
42 num_not_rm_lines=$(echo "$out" | fgrep -c 'this node is not the recmaster') || true
44 if [ $num_rm_lines -eq 1 ] ; then
45 echo "OK, there is only 1 recmaster"
46 else
47 echo "BAD, there are ${num_rm_lines} nodes claiming to be the recmaster"
48 testfailures=1
51 if [ $(($num_all_lines - $num_not_rm_lines)) -eq 1 ] ; then
52 echo "OK, all the other nodes claim not to be the recmaster"
53 else
54 echo "BAD, there are only ${num_not_rm_lines} nodes claiming not to be the recmaster"
55 testfailures=1