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 29a9a7b  Added retry to some tests that were timer based
     new b10d96f  Merge branch 'tp33'
29a9a7b is described below

commit 29a9a7b85f96ff089ede5de74a81aa3600bc4746
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Feb 13 22:02:39 2019 -0500

    Added retry to some tests that were timer based
    
    These tests failed in docker from time to time. This change should reduce 
the chance of that happening. CTR
---
 .../gremlin/server/GremlinDriverIntegrateTest.java | 30 +++++++++++++++++-----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index b281e0a..45295d5 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -330,9 +330,18 @@ public class GremlinDriverIntegrateTest extends 
AbstractGremlinServerIntegration
         startServer();
 
         // default reconnect time is 1 second so wait some extra time to be 
sure it has time to try to bring it
-        // back to life
-        TimeUnit.SECONDS.sleep(3);
-        assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
+        // back to life. usually this passes on the first attempt, but docker 
is sometimes slow and we get failures
+        // waiting for Gremlin Server to pop back up
+        for (int ix = 3; ix < 13; ix++) {
+            TimeUnit.SECONDS.sleep(ix);
+            try {
+                final int result = 
client.submit("1+1").all().join().get(0).getInt();
+                assertEquals(2, result);
+                break;
+            } catch (Exception ignored) {
+                logger.warn("Attempt {} failed on 
shouldEventuallySucceedOnSameServerWithDefault", ix);
+            }
+        }
 
         cluster.close();
     }
@@ -355,9 +364,18 @@ public class GremlinDriverIntegrateTest extends 
AbstractGremlinServerIntegration
         startServer();
 
         // default reconnect time is 1 second so wait some extra time to be 
sure it has time to try to bring it
-        // back to life
-        TimeUnit.SECONDS.sleep(3);
-        assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
+        // back to life. usually this passes on the first attempt, but docker 
is sometimes slow and we get failures
+        // waiting for Gremlin Server to pop back up
+        for (int ix = 3; ix < 13; ix++) {
+            TimeUnit.SECONDS.sleep(ix);
+            try {
+                final int result = 
client.submit("1+1").all().join().get(0).getInt();
+                assertEquals(2, result);
+                break;
+            } catch (Exception ignored) {
+                logger.warn("Attempt {} failed on 
shouldEventuallySucceedOnSameServerWithScript", ix);
+            }
+        }
 
         cluster.close();
     }

Reply via email to