summaryrefslogtreecommitdiff
path: root/ctdb/tests/CLUSTER/complex/11_ctdb_delip_removes_ip.sh
blob: 77e59f8c927dd96dcc6f096b6bdc1bb95feb427c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

# Verify that a node's public IP address can be deleted using 'ctdb deleteip'.

# This is an extended version of simple/17_ctdb_config_delete_ip.sh

. "${TEST_SCRIPTS_DIR}/cluster.bash"

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

echo "Checking that node ${test_node} hosts ${test_ip}..."
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

echo "Waiting for ${test_ip} to disappear from node ${test_node}..."
wait_until 60/5 '!' test_node_has_test_ip

echo "GOOD: IP was successfully removed!"