mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-tests: Simplify IP address checking
Use a new function and wait_until() to simplify. get_test_ip_mask_and_iface() not needed here because select_test_node_and_ips() sets $test_ip, and neither $mask nor $iface is used. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
42aedc62e3
commit
ff4935d180
@ -8,36 +8,27 @@
|
|||||||
|
|
||||||
set -e
|
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
|
ctdb_test_init
|
||||||
|
|
||||||
select_test_node_and_ips
|
select_test_node_and_ips
|
||||||
get_test_ip_mask_and_iface
|
|
||||||
|
|
||||||
echo "Checking that node ${test_node} hosts ${test_ip}..."
|
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}."
|
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 delip $test_ip
|
||||||
try_command_on_node $test_node $CTDB ipreallocate
|
try_command_on_node $test_node $CTDB ipreallocate
|
||||||
wait_until_ips_are_on_node '!' $test_node $test_ip
|
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}..."
|
echo "Waiting for ${test_ip} to disappear from node ${test_node}..."
|
||||||
while :; do
|
wait_until 60/5 '!' test_node_has_test_ip
|
||||||
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
|
|
||||||
|
|
||||||
echo "GOOD: IP was successfully removed!"
|
echo "GOOD: IP was successfully removed!"
|
||||||
|
Loading…
Reference in New Issue
Block a user