Skip to content

Commit 3666bcf

Browse files
authored
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.
1 parent 867cfe0 commit 3666bcf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,7 +2533,7 @@ public void testTransportProfilesWithPortAndHost() {
25332533
assertTrue(profileBoundAddresses.get("some_profile").publishAddress().getPort() < 9000);
25342534
assertTrue(profileBoundAddresses.get("some_other_profile").publishAddress().getPort() >= 8700);
25352535
assertTrue(profileBoundAddresses.get("some_other_profile").publishAddress().getPort() < 8800);
2536-
assertEquals(profileBoundAddresses.get("some_profile").boundAddresses().length, 1);
2536+
assertTrue(profileBoundAddresses.get("some_profile").boundAddresses().length >= 1);
25372537
if (doIPV6) {
25382538
assertTrue(profileBoundAddresses.get("some_other_profile").boundAddresses().length >= 2);
25392539
int ipv4 = 0;
@@ -2550,7 +2550,7 @@ public void testTransportProfilesWithPortAndHost() {
25502550
assertTrue("num ipv4 is wrong: " + ipv4, ipv4 >= 1);
25512551
assertTrue("num ipv6 is wrong: " + ipv6, ipv6 >= 1);
25522552
} else {
2553-
assertEquals(profileBoundAddresses.get("some_other_profile").boundAddresses().length, 1);
2553+
assertTrue(profileBoundAddresses.get("some_other_profile").boundAddresses().length >= 1);
25542554
}
25552555
assertTrue(profileBoundAddresses.get("some_other_profile").publishAddress().address().getAddress() instanceof Inet4Address);
25562556
}

0 commit comments

Comments
 (0)