geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [geode] 01/02: GEODE-3861 ClientHealthMonitorSelectorJUnitTest.testDeadClientRemovalByServer failed
Date Wed, 03 Jan 2018 23:12:40 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit cf4959ff42bc67ef9d78ccac587c93ce53b71105
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
AuthorDate: Wed Jan 3 14:49:02 2018 -0800

    GEODE-3861 ClientHealthMonitorSelectorJUnitTest.testDeadClientRemovalByServer failed
    
    When Alexander tightened up the timing in this test in
    b31de81a8c19c61ad27a2ab803073214050db154 he went a little too far.
    The maximum time between pings was reduced from 2500ms to 50ms,
    allowing the health monitor to timeout the connection for the client
    in testDeadClientRemovalByServer before the test got to the point of using it.  Reversing
the timeout change and increasing the wait time for the health monitor to timeout the client
connection fixes the problem.
    
    Reverting the change and increasing the wait time for the server to timeout
    the thread fixes the problem.
    
    This test wasn't marked flaky until the above changes were made so I'm
    removing the flaky-test category from it and its superclass.
---
 .../tier/sockets/ClientHealthMonitorJUnitTest.java  | 21 +++++++++++----------
 .../ClientHealthMonitorSelectorJUnitTest.java       |  4 +++-
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorJUnitTest.java
index d8a1eb5..71c5d36 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorJUnitTest.java
@@ -26,7 +26,9 @@ import java.util.concurrent.TimeUnit;
 
 import org.awaitility.Awaitility;
 import org.junit.After;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.Statistics;
@@ -53,8 +55,13 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
 /**
  * This is a functional-test for <code>ClientHealthMonitor</code>.
  */
-@Category({IntegrationTest.class, ClientServerTest.class, FlakyTest.class})
+@Category({IntegrationTest.class, ClientServerTest.class})
 public class ClientHealthMonitorJUnitTest {
+
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+
   /**
    * Default to 0; override in sub tests to add thread pool
    */
@@ -106,7 +113,6 @@ public class ClientHealthMonitorJUnitTest {
    */
   private void createProxyAndRegionForClient() {
     try {
-      // props.setProperty("retryAttempts", "5");
       PoolFactory pf = PoolManager.createFactory();
       proxy = (PoolImpl) pf.addServer("localhost", PORT).setThreadLocalConnections(true)
           .setReadTimeout(10000).setPingInterval(10000).setMinConnections(0).create("junitPool");
@@ -119,7 +125,7 @@ public class ClientHealthMonitorJUnitTest {
     }
   }
 
-  private static final int TIME_BETWEEN_PINGS = 50;
+  private static final int TIME_BETWEEN_PINGS = 2500;
 
   /**
    * Creates and starts the server instance
@@ -206,11 +212,6 @@ public class ClientHealthMonitorJUnitTest {
             + statistics.getInt("currentClientConnections"));
     this.system.getLogWriter().info("acquired connection " + connection1);
 
-    int pollInterval = 20;
-    int maximumTimeBetweenPings = ClientHealthMonitor.getInstance().getMaximumTimeBetweenPings();
-
-    long monitorInterval = ClientHealthMonitor.getInstance().getMonitorInterval();
-
     Awaitility.await().pollDelay(0, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS)
         .atMost(1, TimeUnit.SECONDS).until(() -> statistics.getInt("currentClients") ==
1);
 
@@ -221,8 +222,8 @@ public class ClientHealthMonitorJUnitTest {
     srp.putOnForTestsOnly(connection1, "key-1", "value-1", new EventID(new byte[] {1}, 1,
1), null);
     this.system.getLogWriter().info("did put 1");
 
-    Awaitility.await().pollDelay(0, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS)
-        .atMost(1, TimeUnit.SECONDS).until(() -> statistics.getInt("currentClients") ==
0);
+    Awaitility.await().pollDelay(0, TimeUnit.MILLISECONDS).pollDelay(100, TimeUnit.MILLISECONDS)
+        .atMost(5, TimeUnit.SECONDS).until(() -> statistics.getInt("currentClients") ==
0);
 
     this.system.getLogWriter().info("currentClients=" + statistics.getInt("currentClients")
         + " currentClientConnections=" + statistics.getInt("currentClientConnections"));
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorSelectorJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorSelectorJUnitTest.java
index 4f3cb8e..f6cbaf3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorSelectorJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/ClientHealthMonitorSelectorJUnitTest.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.internal.cache.tier.sockets;
 
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.ClientServerTest;
@@ -25,9 +26,10 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
  *
  *
  */
-@Category({IntegrationTest.class, ClientServerTest.class, FlakyTest.class})
+@Category({IntegrationTest.class, ClientServerTest.class})
 public class ClientHealthMonitorSelectorJUnitTest extends ClientHealthMonitorJUnitTest {
   protected int getMaxThreads() {
     return 2;
   }
+
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <commits@geode.apache.org>.

Mime
View raw message