You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2019/06/13 17:22:42 UTC

[geode] 02/05: GEODE-6183: Use SocketCreator.getLocalHost in LocatorLauncherRemoteIntegrationTest

This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 03f8395e17dd24606c79a88ede2b5ff430be0f1e
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Thu May 30 11:19:28 2019 -0700

    GEODE-6183: Use SocketCreator.getLocalHost in LocatorLauncherRemoteIntegrationTest
    
    The tests that were using InetAddress.getLostHost for assertions may
    fail depending on /etc/hosts configuration. This change should prevent
    these failures.
    
    Co-authored-by: Michael Oleske <mo...@pivotal.io>
    Co-authored-by: Mark Hanson <mh...@pivotal.io>
---
 .../distributed/LocatorLauncherRemoteIntegrationTest.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
index 34aa1d5..4b1ad85 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
@@ -22,7 +22,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.io.File;
 import java.net.BindException;
-import java.net.InetAddress;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -30,6 +29,7 @@ import org.junit.Test;
 import org.apache.geode.distributed.LocatorLauncher.Builder;
 import org.apache.geode.distributed.LocatorLauncher.LocatorState;
 import org.apache.geode.internal.GemFireVersion;
+import org.apache.geode.internal.net.SocketCreator;
 import org.apache.geode.internal.process.ProcessControllerFactory;
 
 /**
@@ -132,7 +132,8 @@ public class LocatorLauncherRemoteIntegrationTest extends LocatorLauncherRemoteI
     assertThat(locatorState.getStatus()).isEqualTo(ONLINE);
     assertThat(locatorState.getClasspath()).isEqualTo(getClassPath());
     assertThat(locatorState.getGemFireVersion()).isEqualTo(GemFireVersion.getGemFireVersion());
-    assertThat(locatorState.getHost()).isEqualTo(InetAddress.getLocalHost().getCanonicalHostName());
+    assertThat(locatorState.getHost())
+        .isEqualTo(SocketCreator.getLocalHost().getCanonicalHostName());
     assertThat(locatorState.getJavaVersion()).isEqualTo(System.getProperty("java.version"));
     assertThat(locatorState.getJvmArguments()).isEqualTo(getJvmArguments());
     assertThat(locatorState.getLogFile()).isEqualTo(getLogFile().getCanonicalPath());
@@ -152,7 +153,8 @@ public class LocatorLauncherRemoteIntegrationTest extends LocatorLauncherRemoteI
     assertThat(locatorState.getStatus()).isEqualTo(ONLINE);
     assertThat(locatorState.getClasspath()).isEqualTo(getClassPath());
     assertThat(locatorState.getGemFireVersion()).isEqualTo(GemFireVersion.getGemFireVersion());
-    assertThat(locatorState.getHost()).isEqualTo(InetAddress.getLocalHost().getCanonicalHostName());
+    assertThat(locatorState.getHost())
+        .isEqualTo(SocketCreator.getLocalHost().getCanonicalHostName());
     assertThat(locatorState.getJavaVersion()).isEqualTo(System.getProperty("java.version"));
     assertThat(locatorState.getJvmArguments()).isEqualTo(getJvmArguments());
     assertThat(locatorState.getLogFile()).isEqualTo(getLogFile().getCanonicalPath());
@@ -182,7 +184,8 @@ public class LocatorLauncherRemoteIntegrationTest extends LocatorLauncherRemoteI
     assertThat(locatorState.getStatus()).isEqualTo(NOT_RESPONDING);
     assertThat(locatorState.getClasspath()).isNull();
     assertThat(locatorState.getGemFireVersion()).isEqualTo(GemFireVersion.getGemFireVersion());
-    assertThat(locatorState.getHost()).isEqualTo(InetAddress.getLocalHost().getCanonicalHostName());
+    assertThat(locatorState.getHost())
+        .isEqualTo(SocketCreator.getLocalHost().getCanonicalHostName());
     assertThat(locatorState.getJavaVersion()).isEqualTo(System.getProperty("java.version"));
     assertThat(locatorState.getLogFile()).isNull();
     assertThat(locatorState.getMemberName()).isNull();