This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 16f028e Fix ServerInstanceTest (#4442)
16f028e is described below
commit 16f028ed5cfff621cadc64cdcc106cf261312dce
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Wed Jul 17 16:37:27 2019 -0700
Fix ServerInstanceTest (#4442)
There is no guarantee that 127.0.0.1 gets resolved to localhost
---
.../apache/pinot/transport/common/ServerInstanceTest.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git
a/pinot-transport/src/test/java/org/apache/pinot/transport/common/ServerInstanceTest.java
b/pinot-transport/src/test/java/org/apache/pinot/transport/common/ServerInstanceTest.java
index 5c89d25..3853c7a 100644
---
a/pinot-transport/src/test/java/org/apache/pinot/transport/common/ServerInstanceTest.java
+++
b/pinot-transport/src/test/java/org/apache/pinot/transport/common/ServerInstanceTest.java
@@ -18,6 +18,7 @@
*/
package org.apache.pinot.transport.common;
+import java.net.InetAddress;
import org.apache.pinot.common.response.ServerInstance;
import org.testng.annotations.Test;
@@ -28,21 +29,23 @@ import static org.testng.Assert.assertNotEquals;
public class ServerInstanceTest {
@Test
- public void testServerInstance() {
+ public void testServerInstance()
+ throws Exception {
// Same local host name and port
assertEquals(new ServerInstance("localhost", 8080), new
ServerInstance("localhost", 8080));
- // Same IP address host and port
+ // Same local host IP address and port
assertEquals(new ServerInstance("127.0.0.1", 8080), new
ServerInstance("127.0.0.1", 8080));
// Same other host name and port
assertEquals(new ServerInstance("test-host", 8080), new
ServerInstance("test-host", 8080));
- // Same other IP address host and port
+ // Same other host IP address and port
assertEquals(new ServerInstance("192.168.0.1", 8080), new
ServerInstance("192.168.0.1", 8080));
- // Same local host and port, one with host name and one with IP address
- assertEquals(new ServerInstance("localhost", 8080), new
ServerInstance("127.0.0.1", 8080));
+ // Same local host and port, one with IP address and one with host name
+ assertEquals(new ServerInstance("127.0.0.1", 8080),
+ new ServerInstance(InetAddress.getByName("127.0.0.1").getHostName(),
8080));
// Same host but different port
assertNotEquals(new ServerInstance("localhost", 8081), new
ServerInstance("localhost", 8082));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]