CVE-2016-0771: tests/dns: Remove dependencies on env variables
[Samba.git] / ctdb / tests / complex / 11_ctdb_delip_removes_ip.sh
blobd023e98da8f26c294f5d8d2d3273eaeb0b171943
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify that a node's public IP address can be deleted using 'ctdb deleteip'.
8 This is an extended version of simple/17_ctdb_config_delete_ip.sh
9 EOF
12 . "${TEST_SCRIPTS_DIR}/integration.bash"
14 set -e
16 ctdb_test_init "$@"
18 ctdb_test_check_real_cluster
20 cluster_is_healthy
22 # Reset configuration
23 ctdb_restart_when_done
25 select_test_node_and_ips
26 get_test_ip_mask_and_iface
28 echo "Checking that node ${test_node} hosts ${test_ip} on interface ${iface}..."
29 try_command_on_node $test_node "ip addr show dev $iface | grep -E 'inet6?[[:space:]]*${test_ip}/'"
31 echo "Attempting to remove ${test_ip} from node ${test_node}."
32 try_command_on_node $test_node $CTDB delip $test_ip
33 wait_until_ips_are_on_node '!' $test_node $test_ip
35 timeout=60
36 increment=5
37 count=0
38 echo "Waiting for ${test_ip} to disappear from ${iface}..."
39 while : ; do
40 try_command_on_node -v $test_node "ip addr show dev $iface"
41 if echo "$out" | grep -E 'inet6?[[:space:]]*${test_ip}/'; then
42 echo "Still there..."
43 if [ $(($count * $increment)) -ge $timeout ] ; then
44 echo "BAD: Timed out waiting..."
45 exit 1
47 sleep_for $increment
48 count=$(($count + 1))
49 else
50 break
52 done
54 echo "GOOD: IP was successfully removed!"