Delete some unstructured tests ({fetch,peristent,transaction}.sh) and
[metze/ctdb/wip.git] / tests / simple / 05_ctdb_listnodes.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify that 'ctdb listnodes' shows the list of nodes in a ctdb cluster.
7
8 Prerequisites:
9
10 * An active CTDB cluster with at least 2 active nodes.
11
12 Steps:
13
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.
18
19 Expected results:
20
21 * 'ctdb listnodes' displays the correct information.
22 EOF
23 }
24
25 . ctdb_test_functions.bash
26
27 ctdb_test_init "$@"
28
29 set -e
30
31 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
32
33 try_command_on_node -v 0 "$CTDB listnodes"
34
35 num_nodes=$(echo "$out" | wc -l)
36
37 # Each line should look like an IP address.
38 sanity_check_output \
39     2 \
40     '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$' \
41     "$out"
42
43 out_0="$out"
44
45 echo "Checking other nodes..."
46
47 n=1
48 while [ $n -lt $num_nodes ] ; do
49     echo -n "Node ${n}: "
50     try_command_on_node $n "$CTDB listnodes"
51     if [ "$out_0" = "$out" ] ; then
52         echo "OK"
53     else
54         echo "DIFFERs from node 0:"
55         echo "$out"
56         testfailures=1
57     fi
58     n=$(($n + 1))
59 done
60
61 ctdb_test_exit