78c6fb06b214e56bd3b6489131ab063274106c50
[vlendec/samba-autobuild/.git] / ctdb / tests / simple / 09_ctdb_ping.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify the operation of the 'ctdb ping' command.
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 the 'ctdb ping' command on one of the nodes and verify that it
16    shows valid and expected output. 
17 3. Shutdown one of the cluster nodes, using the 'ctdb shutdown'
18    command. 
19 4. Run the 'ctdb ping -n <node>' command from another node to this
20    node. 
21 5. Verify that the command is not successful since th ctdb daemon is
22    not running on the node.
23
24 Expected results:
25
26 * The 'ctdb ping' command shows valid and expected output.
27 EOF
28 }
29
30 . "${TEST_SCRIPTS_DIR}/integration.bash"
31
32 ctdb_test_init "$@"
33
34 set -e
35
36 cluster_is_healthy
37
38 try_command_on_node -v 0 "$CTDB ping -n 1"
39
40 sanity_check_output \
41     1 \
42     '^response from 1 time=-?[.0-9]+ sec[[:space:]]+\([[:digit:]]+ clients\)$' \
43     "$out"
44
45 try_command_on_node -v 0 "$CTDB shutdown -n 1"
46
47 wait_until_node_has_status 1 disconnected 30 0
48
49 try_command_on_node -v 0 "! $CTDB ping -n 1"
50
51 sanity_check_output \
52     1 \
53     "(: ctdb_control error: ('ctdb_control to disconnected node'|'node is disconnected')|Unable to get ping response from node 1|Node 1 is DISCONNECTED|ctdb_control for getpnn failed|: Can not access node. Node is not operational\.|Node 1 has status DISCONNECTED\|UNHEALTHY\|INACTIVE$)" \
54     "$out"