ctdb-tests: Validate that TAKE_IP works with IP already on an interface
[metze/samba/wip.git] / ctdb / tests / complex / 61_rogueip_takeip.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify that TAKE_IP will work for an IP that is already on an interface
7
8 This is a variation of simple/60_recoverd_missing_ip.sh
9 EOF
10 }
11
12 . "${TEST_SCRIPTS_DIR}/integration.bash"
13
14 ctdb_test_init "$@"
15
16 set -e
17
18 cluster_is_healthy
19
20 # Reset configuration
21 ctdb_restart_when_done
22
23 select_test_node_and_ips
24
25 echo "Running test against node $test_node and IP $test_ip"
26
27 get_test_ip_mask_and_iface
28
29 echo "Deleting IP $test_ip from all nodes"
30 delete_ip_from_all_nodes $test_ip
31 try_command_on_node -v $test_node $CTDB ipreallocate
32 wait_until_ips_are_on_node ! $test_node $test_ip
33
34 try_command_on_node -v all $CTDB ip
35
36 # The window here needs to small, to try to avoid the address being
37 # released.  The test will still pass either way but if the first IP
38 # takeover run does a release then this doesn't test the code path we
39 # expect it to...
40 echo "Adding IP $test_ip to $iface and CTDB on node $test_node"
41 ip_cmd="ip addr add $test_ip/$mask dev $iface"
42 ctdb_cmd="$CTDB addip $test_ip/$mask $iface && $CTDB ipreallocate"
43 try_command_on_node $test_node "$ip_cmd && $ctdb_cmd"
44
45 wait_until_ips_are_on_node $test_node $test_ip