summaryrefslogtreecommitdiffstats
path: root/ctdb/tests
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-11-29 20:01:20 +1100
committerMartin Schwenke <martins@samba.org>2014-12-05 21:02:40 +0100
commita7e7d95de9cf09652cef63d65484bbb0faa42e1c (patch)
treebe76df6958264b0d79919110fa856bf89d992a6d /ctdb/tests
parent0f3d9752c4677b2f3b5ee47a0b8f973b4260ef57 (diff)
downloadsamba-a7e7d95de9cf09652cef63d65484bbb0faa42e1c.tar.gz
samba-a7e7d95de9cf09652cef63d65484bbb0faa42e1c.tar.xz
samba-a7e7d95de9cf09652cef63d65484bbb0faa42e1c.zip
ctdb-tests: Use ip neigh command instead of arp
Extend select_test_node_and_ips() to set $test_prefix in addition to $test_ip. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests')
-rwxr-xr-xctdb/tests/complex/33_gratuitous_arp.sh10
-rwxr-xr-xctdb/tests/complex/41_failover_ping_discrete.sh8
-rwxr-xr-xctdb/tests/complex/42_failover_ssh_hostname.sh4
-rw-r--r--ctdb/tests/scripts/integration.bash5
4 files changed, 16 insertions, 11 deletions
diff --git a/ctdb/tests/complex/33_gratuitous_arp.sh b/ctdb/tests/complex/33_gratuitous_arp.sh
index a51aa0cdce..2ee2e063e0 100755
--- a/ctdb/tests/complex/33_gratuitous_arp.sh
+++ b/ctdb/tests/complex/33_gratuitous_arp.sh
@@ -54,14 +54,14 @@ ctdb_restart_when_done
select_test_node_and_ips
echo "Removing ${test_ip} from the local ARP table..."
-arp -d $test_ip >/dev/null 2>&1 || true
+ip neigh flush "$test_prefix" >/dev/null 2>&1 || true
echo "Pinging ${test_ip}..."
ping_wrapper -q -n -c 1 $test_ip
echo "Getting MAC address associated with ${test_ip}..."
-original_mac=$(arp -n $test_ip | awk '$2 == "ether" {print $3}')
-[ $? -eq 0 ]
+original_mac=$(ip neigh show $test_prefix | awk '$4 == "lladdr" {print $5}')
+[ -n "$original_mac" ] || die "Couldn't get MAC address for ${test_prefix}"
echo "MAC address is: ${original_mac}"
@@ -74,8 +74,8 @@ wait_until_node_has_status $test_node disabled
gratarp_sniff_wait_show
echo "Getting MAC address associated with ${test_ip} again..."
-new_mac=$(arp -n $test_ip | awk '$2 == "ether" {print $3}')
-[ $? -eq 0 ]
+new_mac=$(ip neigh show $test_prefix | awk '$4 == "lladdr" {print $5}')
+[ -n "$new_mac" ] || die "Couldn't get MAC address for ${test_prefix}"
echo "MAC address is: ${new_mac}"
diff --git a/ctdb/tests/complex/41_failover_ping_discrete.sh b/ctdb/tests/complex/41_failover_ping_discrete.sh
index 1fe7c1f548..22780c4025 100755
--- a/ctdb/tests/complex/41_failover_ping_discrete.sh
+++ b/ctdb/tests/complex/41_failover_ping_discrete.sh
@@ -47,8 +47,8 @@ ctdb_restart_when_done
select_test_node_and_ips
-echo "Removing ${test_ip} from the local ARP table..."
-arp -d $test_ip >/dev/null 2>&1 || true
+echo "Removing ${test_ip} from the local neighbor table..."
+ip neigh flush "$test_prefix" >/dev/null 2>&1 || true
echo "Pinging ${test_ip}..."
ping_wrapper -q -n -c 1 $test_ip
@@ -61,8 +61,8 @@ wait_until_node_has_status $test_node disabled
gratarp_sniff_wait_show
-echo "Removing ${test_ip} from the local ARP table again..."
-arp -d $test_ip >/dev/null 2>&1 || true
+echo "Removing ${test_ip} from the local neighbor table again..."
+ip neigh flush "$test_prefix" >/dev/null 2>&1 || true
echo "Pinging ${test_ip} again..."
ping_wrapper -q -n -c 1 $test_ip
diff --git a/ctdb/tests/complex/42_failover_ssh_hostname.sh b/ctdb/tests/complex/42_failover_ssh_hostname.sh
index defe15ad11..a74c63207a 100755
--- a/ctdb/tests/complex/42_failover_ssh_hostname.sh
+++ b/ctdb/tests/complex/42_failover_ssh_hostname.sh
@@ -47,8 +47,8 @@ ctdb_restart_when_done
select_test_node_and_ips
-echo "Removing ${test_ip} from the local ARP table..."
-arp -d $test_ip >/dev/null 2>&1 || true
+echo "Removing ${test_ip} from the local neighbor table..."
+ip neigh flush "$test_prefix" >/dev/null 2>&1 || true
echo "SSHing to ${test_ip} and running hostname..."
original_hostname=$(ssh -o "StrictHostKeyChecking no" $test_ip hostname)
diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash
index 2ae03425f4..6bec78ef98 100644
--- a/ctdb/tests/scripts/integration.bash
+++ b/ctdb/tests/scripts/integration.bash
@@ -186,6 +186,11 @@ _select_test_node_and_ips ()
echo "Selected node ${test_node} with IPs: ${test_node_ips}."
test_ip="${test_node_ips%% *}"
+ case "$test_ip" in
+ *:*) test_prefix="${test_ip}/128" ;;
+ *) test_prefix="${test_ip}/32" ;;
+ esac
+
[ -n "$test_node" ] || return 1
}