summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-09-12 13:40:01 +1000
committerAmitay Isaacs <amitay@samba.org>2014-09-23 08:06:12 +0200
commit81213af32ae17eaae33f9d27c9b7ce63c84ce5df (patch)
tree5bc7a34811b48375cd70f7f921dabd02bc137e38 /ctdb
parent4b8cfe4847477e3cfdb3f4dd7070226a6604bc38 (diff)
downloadsamba-81213af32ae17eaae33f9d27c9b7ce63c84ce5df.tar.gz
ctdb-tests: Factor out new function get_test_ip_mask_and_iface()
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/scripts/integration.bash19
-rwxr-xr-xctdb/tests/simple/60_recoverd_missing_ip.sh14
2 files changed, 20 insertions, 13 deletions
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 548b1e19c04..d40582955b8 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -202,6 +202,25 @@ select_test_node_and_ips ()
return 0
}
+# Sets: mask, iface
+get_test_ip_mask_and_iface ()
+{
+ # Find the interface
+ try_command_on_node $test_node "$CTDB ip -v -Y | awk -F: -v ip=$test_ip '\$2 == ip { print \$4 }'"
+ iface="$out"
+
+ if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
+ # Find the netmask
+ try_command_on_node $test_node ip addr show to $test_ip
+ mask="${out##*/}"
+ mask="${mask%% *}"
+ else
+ mask="24"
+ fi
+
+ echo "$test_ip/$mask is on $iface"
+}
+
#######################################
# Wait until either timeout expires or command succeeds. The command
diff --git a/ctdb/tests/simple/60_recoverd_missing_ip.sh b/ctdb/tests/simple/60_recoverd_missing_ip.sh
index 8ba05702a97..d6d5310662c 100755
--- a/ctdb/tests/simple/60_recoverd_missing_ip.sh
+++ b/ctdb/tests/simple/60_recoverd_missing_ip.sh
@@ -22,19 +22,7 @@ select_test_node_and_ips
echo "Running test against node $test_node and IP $test_ip"
-# Find the interface
-try_command_on_node $test_node "$CTDB ip -v -Y | awk -F: -v ip=$test_ip '\$2 == ip { print \$4 }'"
-iface="$out"
-
-if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
- # Find the netmask
- try_command_on_node $test_node ip addr show to $test_ip
- mask="${out##*/}"
- mask="${mask%% *}"
-else
- mask="24"
-fi
-
+get_test_ip_mask_and_iface
echo "$test_ip/$mask is on $iface"
echo "Deleting IP $test_ip from all nodes"