From 062a413ccd9eaf3a53de91e1fc335d9f2d03a7c0 Mon Sep 17 00:00:00 2001 From: Charles Allen Date: Tue, 28 Apr 2015 10:01:33 -0700 Subject: [PATCH] Fix DruidNodeTest for ipv6 only hosts --- server/src/test/java/io/druid/server/DruidNodeTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/test/java/io/druid/server/DruidNodeTest.java b/server/src/test/java/io/druid/server/DruidNodeTest.java index 110b855e7f9..03b68bea2ec 100644 --- a/server/src/test/java/io/druid/server/DruidNodeTest.java +++ b/server/src/test/java/io/druid/server/DruidNodeTest.java @@ -17,6 +17,7 @@ package io.druid.server; +import com.google.common.net.HostAndPort; import org.junit.Assert; import org.junit.Test; @@ -32,7 +33,9 @@ public class DruidNodeTest node = new DruidNode(service, null, null); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(-1, node.getPort()); - Assert.assertEquals(DruidNode.getDefaultHost(), node.getHostAndPort()); + // Hosts which report only ipv6 will have getDefaultHost() report something like fe80::6e40:8ff:fe93:9230 + // but getHostAndPort() reports [fe80::6e40:8ff:fe93:9230] + Assert.assertEquals(HostAndPort.fromString(DruidNode.getDefaultHost()).toString(), node.getHostAndPort()); node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", -1); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost());