You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rh...@apache.org on 2020/03/28 08:55:05 UTC

[geode] branch develop updated: GEODE-7918: Add assertion message to DNS resolution assertions. (#4859)

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 472e2e7  GEODE-7918: Add assertion message to DNS resolution assertions. (#4859)
472e2e7 is described below

commit 472e2e73ad5f4b2afdb56cc3ece92b9cdb1bfcf1
Author: Robert Houghton <rh...@pivotal.io>
AuthorDate: Sat Mar 28 01:54:38 2020 -0700

    GEODE-7918: Add assertion message to DNS resolution assertions. (#4859)
    
    * GEODE-7918: Add assertion message to DNS resolution assertions.
    
    In the case of DNS hijacking by an ISP, unresolvable hostnames may be
    redirected to a search page. Log this breadcrumb in the test failures.
---
 .../geode/distributed/internal/tcpserver/HostAndPortTest.java     | 8 ++++++--
 .../geode/distributed/internal/tcpserver/TcpServerJUnitTest.java  | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/HostAndPortTest.java b/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/HostAndPortTest.java
index dbad906..9625d55 100644
--- a/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/HostAndPortTest.java
+++ b/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/HostAndPortTest.java
@@ -54,7 +54,9 @@ public class HostAndPortTest {
 
     InetSocketAddress actual = locator1.getSocketInetAddress();
 
-    assertThat(actual.isUnresolved()).isTrue();
+    assertThat(actual.isUnresolved())
+        .as("Hostname resolved unexpectedly. Check for DNS hijacking in addition to code errors.")
+        .isTrue();
   }
 
   /**
@@ -143,7 +145,9 @@ public class HostAndPortTest {
         .readObject(new ByteArrayDataInput(out.toByteArray()));
     assertThat(hostAndPort1).isEqualTo(hostAndPort2);
     assertThat(hostAndPort2).isEqualTo(hostAndPort1);
-    assertThat(hostAndPort1.getAddress()).isNull();
+    assertThat(hostAndPort1.getAddress())
+        .as("Hostname resolved unexpectedly. Check for DNS hijacking in addition to code errors.")
+        .isNull();
     assertThat(hostAndPort2.getAddress()).isNull();
     assertThat(hostAndPort2.getSocketInetAddress()).isNotNull();
     assertThat(hostAndPort1.getSocketInetAddress().isUnresolved()).isTrue();
diff --git a/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java b/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java
index 3aa6ee2..6a8f9fc 100644
--- a/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java
+++ b/geode-tcp-server/src/test/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java
@@ -84,7 +84,9 @@ public class TcpServerJUnitTest {
     @SuppressWarnings("deprecation")
     InfoRequest testInfoRequest = new InfoRequest();
     assertThatThrownBy(() -> tcpClient.requestToServer(new HostAndPort("unknown host name", port),
-        testInfoRequest, TIMEOUT)).isInstanceOf(UnknownHostException.class);
+        testInfoRequest, TIMEOUT))
+            .as("Hostname resolved unexpectedly. Check for DNS hijacking in addition to code errors.")
+            .isInstanceOf(UnknownHostException.class);
   }
 
   @SuppressWarnings("deprecation")