ctdb-scripts: New consistent system memory and swap monitoring
[Samba.git] / ctdb / tests / simple / 60_recoverd_missing_ip.sh
blob9ad7b69171077b3720f694b1fdbf206a41a91917
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that the recovery daemon handles unhosted IPs properly.
8 This test does not do any network level checks to make sure the IP
9 address is actually on an interface. It just consults "ctdb ip".
11 This is a variation of the "addip" test.
12 EOF
15 . "${TEST_SCRIPTS_DIR}/integration.bash"
17 ctdb_test_init "$@"
19 set -e
21 cluster_is_healthy
23 # Reset configuration
24 ctdb_restart_when_done
26 select_test_node_and_ips
28 echo "Running test against node $test_node and IP $test_ip"
30 get_test_ip_mask_and_iface
32 echo "Deleting IP $test_ip from all nodes"
33 try_command_on_node $test_node $CTDB delip -n all $test_ip
34 wait_until_ips_are_on_node ! $test_node $test_ip
36 try_command_on_node -v all $CTDB ip
38 my_exit_hook ()
40 if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
41 onnode -q all $CTDB enablescript "10.interface"
45 ctdb_test_exit_hook_add my_exit_hook
47 # This forces us to wait until the ipreallocated associated with the
48 # delips is complete.
49 try_command_on_node $test_node $CTDB sync
51 # Wait for a monitor event. Then the next steps are unlikely to occur
52 # in the middle of a monitor event and will have the expected effect.
53 wait_for_monitor_event $test_node
55 if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
56 # Stop monitor events from bringing up the link status of an interface
57 try_command_on_node $test_node $CTDB disablescript 10.interface
60 echo "Marking interface $iface down on node $test_node"
61 try_command_on_node $test_node $CTDB setifacelink $iface down
63 echo "Adding IP $test_ip to node $test_node"
64 try_command_on_node $test_node $CTDB addip $test_ip/$mask $iface
66 echo "Wait long enough for IP verification to have taken place"
67 sleep_for 15
69 echo "Ensuring that IP ${test_ip} is not hosted on node ${test_node} when interface is down"
70 if ips_are_on_node '!' $test_node $test_ip; then
71 echo "GOOD: the IP has not been hosted while the interface is down"
72 else
73 echo "BAD: the IP is hosted but the interface is down"
74 exit 1
77 echo "Marking interface $iface up on node $test_node"
78 try_command_on_node $test_node $CTDB setifacelink $iface up
79 wait_until_ips_are_on_node $test_node $test_ip