diff options
author | valerijf <valerijf@yahoo-inc.com> | 2016-08-29 11:18:20 +0200 |
---|---|---|
committer | valerijf <valerijf@yahoo-inc.com> | 2016-08-29 11:18:20 +0200 |
commit | abfb2a7563899cb00c6f87fed2f48055bb9a09a1 (patch) | |
tree | 64d0f25c81fe0c2ac55c5fb56f1c5b02a8b24fef /container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java | |
parent | 0afe8142ad7a5dc374fd6dc943695b407138ad6d (diff) |
Replaced InetAddress.getCanonicalHostName() with HostName.getLocalHost() for docker IPv6 compatibility
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java')
-rw-r--r-- | container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java index c3d11e1c929..1645399e2ed 100644 --- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java +++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java @@ -7,10 +7,10 @@ import com.yahoo.container.QrSearchersConfig; import com.yahoo.container.search.Fs4Config; import com.yahoo.container.search.LegacyEmulationConfig; import com.yahoo.fs4.QueryPacket; +import com.yahoo.net.HostName; import com.yahoo.prelude.*; import com.yahoo.prelude.fastsearch.*; import com.yahoo.search.Query; -import com.yahoo.search.Result; import com.yahoo.search.config.ClusterConfig; import com.yahoo.search.result.Hit; import com.yahoo.search.searchchain.Execution; @@ -400,7 +400,6 @@ public class ClusterSearcherTestCase extends junit.framework.TestCase { public void testLocalConnect() throws UnknownHostException { ClusterSearcher cluster = new ClusterSearcher(new LinkedHashSet<>(Arrays.asList("dummy"))); - boolean canGetLocalName; boolean canFindYahoo; final String yahoo = "www.yahoo.com"; @@ -414,20 +413,9 @@ public class ClusterSearcherTestCase extends junit.framework.TestCase { canFindYahoo = false; } - try { - InetAddress.getLocalHost().getCanonicalHostName(); - canGetLocalName = true; - } catch (Exception e) { - canGetLocalName = false; - } - assertFalse(cluster.isRemote("127.0.0.1")); assertFalse(cluster.isRemote("localhost")); - - if (canGetLocalName) { - assertFalse(cluster.isRemote(InetAddress.getLocalHost() - .getCanonicalHostName())); - } + assertFalse(cluster.isRemote(HostName.getLocalhost())); if (canFindYahoo) { assertTrue(cluster.isRemote(yahoo)); |