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

bschuchardt pushed a commit to branch support/1.13
in repository https://gitbox.apache.org/repos/asf/geode.git

commit bcc097a6dda38ab276720521ab0308cef7a4c1be
Author: Bruce Schuchardt <bschucha...@pivotal.io>
AuthorDate: Wed May 27 16:55:15 2020 -0700

    GEODE-8144 another attempt to fix a failing test (#5172)
    
    * modified SocketCreator to look for a hostname if one is not present and 
endpoint verification is enabled
    
    This fixes some problems when running in docker containers
    
    * removed test shell script
    
    * GEODE-8144 another attempt to fix a failing test
    
    The JMX tests in this test class use "localhost" to connect to a
    Manager.  This is being transformed somehow into an IP numeric address
    and is failing endpoint verification.  The test passes on my Windows machine
    and also passes on Mac and Ubuntu when I run it there.  I'm
    adding the "localhost" IP address to the certificate to get past this.
    Another fix would be to change the Rule that's using "localhost" to
    use the real host name but that would affect a lot of other tests.
    
    Before I started messing with this test it was adding
    InetAddress.getLocalHost() as an IP address to the certificate so I
    don't think this is a big change to the original test.  The test now
    uses LocalHostUtils.getLocalHost() to get an IP to add to the
    certificate, which is the correct "localhost" to use with Geode.
    
    (cherry picked from commit 42c11640c75ae87038e07cbde3c98a3ca6b36987)
---
 .../cli/commands/GfshHostNameVerificationDistributedTest.java  | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/GfshHostNameVerificationDistributedTest.java
 
b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/GfshHostNameVerificationDistributedTest.java
index 4d5f40d..d8014f4 100644
--- 
a/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/GfshHostNameVerificationDistributedTest.java
+++ 
b/geode-gfsh/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/GfshHostNameVerificationDistributedTest.java
@@ -29,7 +29,6 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.admin.internal.InetAddressUtils;
 import org.apache.geode.cache.ssl.CertStores;
 import org.apache.geode.cache.ssl.CertificateBuilder;
 import org.apache.geode.cache.ssl.CertificateMaterial;
@@ -69,11 +68,10 @@ public class GfshHostNameVerificationDistributedTest {
         .sanDnsName(InetAddress.getLoopbackAddress().getHostName())
         .sanDnsName(hostname)
         .sanIpAddress(InetAddress.getByName("0.0.0.0"));
-    if (InetAddressUtils.isIPLiteral(hostname)) {
-      // no valid hostname for this machine's IP address, so sanDnsName won't 
work
-      // and we need to use a sanIpAddress
-      builder.sanIpAddress(LocalHostUtil.getLocalHost());
-    }
+    // the rules used by this test use "localhost" as a hostname, which
+    // causes it to use a non-loopback IP literal address instead of the
+    // host's name on CI Windows runs
+    builder.sanIpAddress(LocalHostUtil.getLocalHost());
     CertificateMaterial locatorCertificate = builder.generate();
 
     CertificateMaterial gfshCertificate = new CertificateBuilder()

Reply via email to