Fix IPV6 Scope ID Test (#60360) (#60363)

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:
Armin Braun 2020-07-29 09:55:37 +02:00 committed by GitHub
parent 578749a5e8
commit 4307a45153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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));