1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

tests: add a all_ips_on_node() helper function that wraps ctdb ip -Y

metze

(This used to be ctdb commit c24fbea156dfdc9154e94eace725526e44cbcdac)
This commit is contained in:
Stefan Metzmacher 2010-01-16 10:35:41 +01:00
parent 04d896a5fe
commit 0054f0c54f
4 changed files with 14 additions and 7 deletions

View File

@ -239,7 +239,7 @@ sanity_check_output ()
sanity_check_ips ()
{
local ips="$1" # Output of "ctdb ip -n all"
local ips="$1" # list of "ip node" lines
echo "Sanity checking IPs..."
@ -259,9 +259,16 @@ sanity_check_ips ()
return 1
}
# This returns a list of "ip node" lines in $out
all_ips_on_node()
{
local node=$@
try_command_on_node $node "$CTDB ip -Y -n all | cut -d ':' -f1-3 | sed -e '1d' -e 's@^:@@' -e 's@:@ @g'"
}
select_test_node_and_ips ()
{
try_command_on_node 0 "$CTDB ip -n all | sed -e '1d'"
all_ips_on_node 0
# When selecting test_node we just want a node that has public
# IPs. This will work and is economically semi-random. :-)
@ -450,7 +457,7 @@ ips_are_on_nodeglob ()
local out
try_command_on_node 1 ctdb ip -n all
all_ips_on_node 1
while read ip pnn ; do
for check in $ips ; do

View File

@ -46,7 +46,7 @@ cluster_is_healthy
ctdb_restart_when_done
echo "Getting list of public IPs..."
try_command_on_node 0 "$CTDB ip -n all | sed -e '1d'"
all_ips_on_node 0
# When selecting test_node we just want a node that has public IPs.
# This will work and is economically semi-randomly. :-)

View File

@ -21,7 +21,7 @@ Steps:
3. Delete one public IP address being be served by the node, using
'ctdb delip'.
4. Verify that the delete IP address is no longer listed using the
'ctdb ip' command.
all_ips_on_node helper function.
Expected results:
@ -42,7 +42,7 @@ cluster_is_healthy
ctdb_restart_when_done
echo "Getting list of public IPs..."
try_command_on_node -v 0 "$CTDB ip -n all | sed -e '1d'"
all_ips_on_node -v 0
# Select an IP/node to remove.
num_ips=$(echo "$out" | wc -l)

View File

@ -50,7 +50,7 @@ if [ $num_nodes -lt 2 ] ; then
fi
echo "Getting list of public IPs..."
try_command_on_node -v 0 "$CTDB ip -n all | sed -e '1d'"
all_ips_on_node -v 0
sanity_check_ips "$out"