You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/03/15 19:57:22 UTC

[tinkerpop] branch master updated: Move assert of logs out after the Cluster is closed

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

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new 3284f2e  Move assert of logs out after the Cluster is closed
     new 0d24715  Merge branch 'tp33'
3284f2e is described below

commit 3284f2e37974eeb2376967a2b86ecce808b9e277
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Fri Mar 15 15:55:20 2019 -0400

    Move assert of logs out after the Cluster is closed
    
    By moving the assert out, the executors in the Cluster all get a chance to finish completely with orderly shutdown allowing all logs to be flushed. Without that this test failed nondeterministically at times. Hope that solves the problem. CTR
---
 .../gremlin/driver/ClientConnectionIntegrateTest.java      | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientConnectionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientConnectionIntegrateTest.java
index c4e596d..6e9a262 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientConnectionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/ClientConnectionIntegrateTest.java
@@ -31,6 +31,7 @@ import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 public class ClientConnectionIntegrateTest extends AbstractGremlinServerIntegrationTest {
@@ -88,18 +89,19 @@ public class ClientConnectionIntegrateTest extends AbstractGremlinServerIntegrat
             }
 
             // Assert that the host has not been marked unavailable
-            Assert.assertEquals(1, cluster.availableHosts().size());
+            assertEquals(1, cluster.availableHosts().size());
 
             // Assert that there is no connection leak and all connections have been closed
-            Assert.assertEquals(0, client.hostConnectionPools.values().stream()
+            assertEquals(0, client.hostConnectionPools.values().stream()
                                                              .findFirst().get()
                                                              .numConnectionsWaitingToCleanup());
-
-            // Assert that the connection has been destroyed. Specifically check for the string with
-            // isDead=true indicating the connection that was closed due to CorruptedFrameException.
-            assertThat(recordingAppender.logContainsAny("^(?!.*(isDead=false)).*isDead=true.*destroyed successfully.$"), is(true));
         } finally {
             cluster.close();
         }
+
+        // Assert that the connection has been destroyed. Specifically check for the string with
+        // isDead=true indicating the connection that was closed due to CorruptedFrameException.
+        assertThat(recordingAppender.logContainsAny("^(?!.*(isDead=false)).*isDead=true.*destroyed successfully.$"), is(true));
+
     }
 }