From 3666bcfbd8a9819e225a62894ad00861f3b82615 Mon Sep 17 00:00:00 2001 From: Rory Hunter Date: Thu, 29 Aug 2019 09:45:51 +0100 Subject: [PATCH] Handle multiple loopback addresses (#46061) AbstractSimpleTransportTestCase.testTransportProfilesWithPortAndHost expects a host to only have a single IPv4 loopback address, which isn't necessarily the case. Allow for >= 1 address. Backport of #45901. --- .../transport/AbstractSimpleTransportTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java index ca69c101181f1..d755a3a164293 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java @@ -2533,7 +2533,7 @@ public void testTransportProfilesWithPortAndHost() { assertTrue(profileBoundAddresses.get("some_profile").publishAddress().getPort() < 9000); assertTrue(profileBoundAddresses.get("some_other_profile").publishAddress().getPort() >= 8700); assertTrue(profileBoundAddresses.get("some_other_profile").publishAddress().getPort() < 8800); - assertEquals(profileBoundAddresses.get("some_profile").boundAddresses().length, 1); + assertTrue(profileBoundAddresses.get("some_profile").boundAddresses().length >= 1); if (doIPV6) { assertTrue(profileBoundAddresses.get("some_other_profile").boundAddresses().length >= 2); int ipv4 = 0; @@ -2550,7 +2550,7 @@ public void testTransportProfilesWithPortAndHost() { assertTrue("num ipv4 is wrong: " + ipv4, ipv4 >= 1); assertTrue("num ipv6 is wrong: " + ipv6, ipv6 >= 1); } else { - assertEquals(profileBoundAddresses.get("some_other_profile").boundAddresses().length, 1); + assertTrue(profileBoundAddresses.get("some_other_profile").boundAddresses().length >= 1); } assertTrue(profileBoundAddresses.get("some_other_profile").publishAddress().address().getAddress() instanceof Inet4Address); }