Use real scope id from first available interface instead of `lo` which might not exist on non-Linux platforms. Closes #60332
This commit is contained in:
parent
578749a5e8
commit
4307a45153
|
@ -21,6 +21,7 @@ import org.elasticsearch.test.ESTestCase;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
public class InetAddressesTests extends ESTestCase {
|
public class InetAddressesTests extends ESTestCase {
|
||||||
|
@ -128,9 +129,8 @@ public class InetAddressesTests extends ESTestCase {
|
||||||
assertTrue(InetAddresses.isInetAddress(ipStr));
|
assertTrue(InetAddresses.isInetAddress(ipStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/60332")
|
public void testForStringIPv6WithScopeIdInput() throws java.io.IOException {
|
||||||
public void testForStringIPv6WithScopeIdInput() throws UnknownHostException {
|
String ipStr = "0:0:0:0:0:0:0:1%" + NetworkInterface.getNetworkInterfaces().nextElement().getName();
|
||||||
String ipStr = "0:0:0:0:0:0:0:1%lo";
|
|
||||||
InetAddress ipv6Addr = InetAddress.getByName(ipStr);
|
InetAddress ipv6Addr = InetAddress.getByName(ipStr);
|
||||||
assertEquals(ipv6Addr, InetAddresses.forString(ipStr));
|
assertEquals(ipv6Addr, InetAddresses.forString(ipStr));
|
||||||
assertTrue(InetAddresses.isInetAddress(ipStr));
|
assertTrue(InetAddresses.isInetAddress(ipStr));
|
||||||
|
|
Loading…
Reference in New Issue