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.
This commit is contained in:
Rory Hunter 2019-08-29 09:45:51 +01:00 committed by GitHub
parent 867cfe0223
commit 3666bcfbd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2533,7 +2533,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
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 abstract class AbstractSimpleTransportTestCase extends ESTestCase {
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);
}