Test suite: wait_until_node_has_status() now uses "onnode any".
[tridge/ctdb.git] / tests / simple / 42_ctdb_continue.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify the operation of the 'ctdb continue' command.
7
8 This is a superficial test of the 'ctdb continue' command.  It trusts
9 information from CTDB that indicates that the IP failover and failback
10 has happened correctly.  Another test should check that the failover
11 and failback 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 5. Use 'ctdb continue' to bring the node back online.
25 6. Verify that the status of the node changes back to 'OK' and that
26    the public IP addresses move back to the node.
27
28 Expected results:
29
30 * The 'ctdb continue' command successfully brings a stopped node online.
31 EOF
32 }
33
34 . ctdb_test_functions.bash
35
36 ctdb_test_init "$@"
37
38 set -e
39
40 cluster_is_healthy
41
42 # Reset configuration
43 ctdb_restart_when_done
44
45 select_test_node_and_ips
46
47 echo "Stopping node ${test_node}..."
48 try_command_on_node 1 $CTDB stop -n $test_node
49
50 wait_until_node_has_status $test_node stopped
51
52 if wait_until_ips_are_on_nodeglob "[!${test_node}]" $ips ; then
53     echo "All IPs moved."
54 else
55     echo "Some IPs didn't move."
56     testfailures=1
57 fi
58
59 echo "Continuing node $test_node"
60 try_command_on_node 1 $CTDB continue -n $test_node
61
62 wait_until_node_has_status $test_node notstopped
63
64 # BUG: this is only guaranteed if DeterministicIPs is 1 and
65 #      NoIPFailback is 0.
66 if wait_until_ips_are_on_nodeglob "$test_node" $ips ; then
67     echo "All IPs moved."
68 else
69     echo "Some IPs didn't move."
70     testfailures=1
71 fi