Merge pull request #1319 from metamx/fixipv6UnitTests

Fix DruidNodeTest for ipv6 only hosts
This commit is contained in:
Xavier Léauté 2015-04-28 15:41:11 -07:00
commit e5d61f4e6e
1 changed files with 4 additions and 1 deletions

View File

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