ldb: Release ldb 1.3.0
[Samba.git] / ctdb / tests / simple / 05_ctdb_listnodes.sh
blob9e48a68e3c05675dee084b8b3eba42b581d1b770
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that 'ctdb listnodes' shows the list of nodes in a ctdb cluster.
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 listnodes' on all the nodes of the cluster.
16 3. Verify that one all the nodes the command displays a list of
17 current cluster nodes.
19 Expected results:
21 * 'ctdb listnodes' displays the correct information.
22 EOF
25 . "${TEST_SCRIPTS_DIR}/integration.bash"
27 ctdb_test_init "$@"
29 set -e
31 cluster_is_healthy
33 try_command_on_node -v 0 "$CTDB listnodes"
35 num_nodes=$(echo "$out" | wc -l)
37 # Each line should look like an IP address.
38 ipv4_pat='[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+'
39 ipv6_pat='[[:xdigit:]]+:[[:xdigit:]:]+[[:xdigit:]]+'
40 sanity_check_output \
41 2 \
42 "^${ipv4_pat}|${ipv6_pat}\$" \
43 "$out"
45 out_0="$out"
47 echo "Checking other nodes..."
49 n=1
50 while [ $n -lt $num_nodes ] ; do
51 echo -n "Node ${n}: "
52 try_command_on_node $n "$CTDB listnodes"
53 if [ "$out_0" = "$out" ] ; then
54 echo "OK"
55 else
56 echo "DIFFERs from node 0:"
57 echo "$out"
58 testfailures=1
60 n=$(($n + 1))
61 done