diff options
author | Martin Schwenke <martin@meltin.net> | 2022-08-11 09:15:38 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2022-08-25 15:22:36 +0000 |
commit | ff4935d180e1a290e4ba7ab0f8710d9a022d1b82 (patch) | |
tree | af3c766587ad6b54295551fe3a605d726cdad9e5 /ctdb | |
parent | 42aedc62e3a16bcdafbef06140105650f15f6269 (diff) | |
download | samba-ff4935d180e1a290e4ba7ab0f8710d9a022d1b82.tar.gz |
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>
Diffstat (limited to 'ctdb')
-rwxr-xr-x | ctdb/tests/CLUSTER/complex/11_ctdb_delip_removes_ip.sh | 29 |
1 files changed, 10 insertions, 19 deletions
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!" |