ctdb-tests: Simplify IP address checking
[Samba.git] / ctdb / tests / CLUSTER / complex / 11_ctdb_delip_removes_ip.sh
blob77e59f8c927dd96dcc6f096b6bdc1bb95feb427c
1 #!/bin/bash
3 # Verify that a node's public IP address can be deleted using 'ctdb deleteip'.
5 # This is an extended version of simple/17_ctdb_config_delete_ip.sh
7 . "${TEST_SCRIPTS_DIR}/cluster.bash"
9 set -e
11 test_node_has_test_ip()
13 # $test_node and $test_ip set by select_test_node_and_ips()
14 # shellcheck disable=SC2154
15 try_command_on_node "$test_node" "ip addr show to ${test_ip}"
16 [ -n "$out" ]
19 ctdb_test_init
21 select_test_node_and_ips
23 echo "Checking that node ${test_node} hosts ${test_ip}..."
24 test_node_has_test_ip
26 echo "Attempting to remove ${test_ip} from node ${test_node}."
27 try_command_on_node $test_node $CTDB delip $test_ip
28 try_command_on_node $test_node $CTDB ipreallocate
29 wait_until_ips_are_on_node '!' $test_node $test_ip
31 echo "Waiting for ${test_ip} to disappear from node ${test_node}..."
32 wait_until 60/5 '!' test_node_has_test_ip
34 echo "GOOD: IP was successfully removed!"