e7a825002e56dc93fd4927df4e231421d68ca8df
[amitay/samba.git] / ctdb / tests / simple / 43_stop_recmaster_yield.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify that 'ctdb stop' causes a node to yield the recovery master role.
7
8 Prerequisites:
9
10 * An active CTDB cluster with at least 2 active nodes.
11
12 Steps:
13
14 1. Determine which node is the recmaster.
15 2. Stop this node using the 'ctdb stop' command.
16 3. Verify that the status of the node changes to 'stopped'.
17 4. Verify that this node no longer has the recovery master role.
18
19 Expected results:
20
21 * The 'ctdb stop' command causes a node to yield the recmaster role.
22 EOF
23 }
24
25 . "${TEST_SCRIPTS_DIR}/integration.bash"
26
27 ctdb_test_init "$@"
28
29 set -e
30
31 cluster_is_healthy
32
33 # Reset configuration
34 ctdb_restart_when_done
35
36 echo "Finding out which node is the recovery master..."
37 try_command_on_node -v 0 "$CTDB recmaster"
38 test_node=$out
39
40 echo "Stopping node ${test_node} - it is the current recmaster..."
41 try_command_on_node 1 $CTDB stop -n $test_node
42
43 wait_until_node_has_status $test_node stopped
44
45 echo "Checking which node is the recovery master now..."
46 try_command_on_node -v 0 "$CTDB recmaster"
47 recmaster=$out
48
49 if [ "$recmaster" != "$test_node" ] ; then
50     echo "OK: recmaster moved to node $recmaster"
51 else
52     echo "BAD: recmaster did not move"
53     exit 1
54 fi