TMP: add a ctdb snapshot of current ctdb master (git://git.samba.org/ctdb.git) to...
[obnox/samba/samba-obnox.git] / ctdb / tests / simple / 41_ctdb_stop.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify the operation of the 'ctdb stop' command.
7
8 This is a superficial test of the 'ctdb stop' command.  It trusts
9 information from CTDB that indicates that the IP failover has
10 happened correctly.  Another test should check that the failover
11 has actually happened at the networking level.
12
13 Prerequisites:
14
15 * An active CTDB cluster with at least 2 active nodes.
16
17 Steps:
18
19 1. Verify that the status on all of the ctdb nodes is 'OK'.
20 2. Stop one of the nodes using the 'ctdb stop' command.
21 3. Verify that the status of the node changes to 'stopped'.
22 4. Verify that the public IP addresses that were being served by
23    the node are failed over to one of the other nodes.
24
25 Expected results:
26
27 * The status of the stopped nodes changes as expected and IP addresses
28   failover as expected.
29 EOF
30 }
31
32 . ctdb_test_functions.bash
33
34 ctdb_test_init "$@"
35
36 set -e
37
38 cluster_is_healthy
39
40 # Reset configuration
41 ctdb_restart_when_done
42
43 select_test_node_and_ips
44
45 echo "Stopping node ${test_node}..."
46 try_command_on_node 1 $CTDB stop -n $test_node
47
48 wait_until_node_has_status $test_node stopped
49
50 if wait_until_ips_are_on_nodeglob "[!${test_node}]" $ips ; then
51     echo "All IPs moved."
52 else
53     echo "Some IPs didn't move."
54     testfailures=1
55 fi