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 2021/05/14 12:22:44 UTC

[tinkerpop] 01/01: Reorganized test to better error out and cleanup CTR

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

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

commit 3780c91533f297eafe173505a2b522951d522d98
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Fri May 14 08:21:58 2021 -0400

    Reorganized test to better error out and cleanup CTR
---
 .../server/GremlinServerSessionIntegrateTest.java  | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 48919b5..588d36b 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -416,7 +416,13 @@ public class GremlinServerSessionIntegrateTest extends AbstractGremlinServerInte
         assumeNeo4jIsPresent();
 
         final Cluster cluster = TestClientFactory.open();
-        final Client client = cluster.connect(name.getMethodName(), true);
+        final Client.SessionSettings sessionSettings = Client.SessionSettings.build().
+                sessionId(name.getMethodName()).
+                manageTransactions(true).
+                maintainStateAfterException(false).
+                create();
+        final Client.Settings clientSettings = Client.Settings.build().useSession(sessionSettings).create();
+        final Client client = cluster.connect(clientSettings);
 
         try {
             client.submit("graph.addVertex(); throw new Exception('no worky')").all().get();
@@ -424,15 +430,17 @@ public class GremlinServerSessionIntegrateTest extends AbstractGremlinServerInte
         } catch (Exception ex) {
             final Throwable root = ExceptionUtils.getRootCause(ex);
             assertEquals("no worky", root.getMessage());
-
-            // just force a commit here of "something" to ensure the rollback of the previous request
-            client.submit("graph.addVertex(); graph.tx().commit()").all().get();
         }
 
-        // the transaction is managed so a rollback should have executed
-        assertEquals(1, client.submit("g.V().count()").all().get().get(0).getInt());
+        try {
+            // just force a commit here of "something" to ensure the rollback of the previous request
+            client.submit("graph.addVertex(); graph.tx().commit()").all().get(10, TimeUnit.SECONDS);
 
-        cluster.close();
+            // the transaction is managed so a rollback should have executed
+            assertEquals(1, client.submit("g.V().count()").all().get(10, TimeUnit.SECONDS).get(0).getInt());
+        } finally {
+            cluster.close();
+        }
     }
 
     @Test