diff --git a/ctdb/tests/CLUSTER/complex/11_ctdb_delip_removes_ip.sh b/ctdb/tests/CLUSTER/complex/11_ctdb_delip_removes_ip.sh index 72a498b2dd8..77e59f8c927 100755 --- a/ctdb/tests/CLUSTER/complex/11_ctdb_delip_removes_ip.sh +++ b/ctdb/tests/CLUSTER/complex/11_ctdb_delip_removes_ip.sh @@ -8,36 +8,27 @@ set -e +test_node_has_test_ip() +{ + # $test_node and $test_ip set by select_test_node_and_ips() + # shellcheck disable=SC2154 + try_command_on_node "$test_node" "ip addr show to ${test_ip}" + [ -n "$out" ] +} + ctdb_test_init select_test_node_and_ips -get_test_ip_mask_and_iface echo "Checking that node ${test_node} hosts ${test_ip}..." -try_command_on_node $test_node "ip addr show to ${test_ip} | grep -q ." +test_node_has_test_ip echo "Attempting to remove ${test_ip} from node ${test_node}." try_command_on_node $test_node $CTDB delip $test_ip try_command_on_node $test_node $CTDB ipreallocate wait_until_ips_are_on_node '!' $test_node $test_ip -timeout=60 -increment=5 -count=0 echo "Waiting for ${test_ip} to disappear from node ${test_node}..." -while :; do - try_command_on_node -v $test_node "ip addr show to ${test_ip}" - if [ -n "$out" ]; then - echo "Still there..." - if [ $(($count * $increment)) -ge $timeout ]; then - echo "BAD: Timed out waiting..." - exit 1 - fi - sleep_for $increment - count=$(($count + 1)) - else - break - fi -done +wait_until 60/5 '!' test_node_has_test_ip echo "GOOD: IP was successfully removed!"