ctdb-tests: Avoid bulk output in $out, prefer $outfile
[vlendec/samba-autobuild/.git] / ctdb / tests / complex / 11_ctdb_delip_removes_ip.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify that a node's public IP address can be deleted using 'ctdb deleteip'.
7
8 This is an extended version of simple/17_ctdb_config_delete_ip.sh
9 EOF
10 }
11
12 . "${TEST_SCRIPTS_DIR}/integration.bash"
13
14 set -e
15
16 ctdb_test_init
17
18 ctdb_test_check_real_cluster
19
20 cluster_is_healthy
21
22 select_test_node_and_ips
23 get_test_ip_mask_and_iface
24
25 echo "Checking that node ${test_node} hosts ${test_ip}..."
26 try_command_on_node $test_node "ip addr show to ${test_ip} | grep -q ."
27
28 echo "Attempting to remove ${test_ip} from node ${test_node}."
29 try_command_on_node $test_node $CTDB delip $test_ip
30 try_command_on_node $test_node $CTDB ipreallocate
31 wait_until_ips_are_on_node '!' $test_node $test_ip
32
33 timeout=60
34 increment=5
35 count=0
36 echo "Waiting for ${test_ip} to disappear from node ${test_node}..."
37 while : ; do
38     try_command_on_node -v $test_node "ip addr show to ${test_node}"
39     if -n "$out" ; then
40         echo "Still there..."
41         if [ $(($count * $increment)) -ge $timeout ] ; then
42             echo "BAD: Timed out waiting..."
43             exit 1
44         fi
45         sleep_for $increment
46         count=$(($count + 1))
47     else
48         break
49     fi
50 done
51
52 echo "GOOD: IP was successfully removed!"