Allow some extra time to be sure the future completes

This test never fails on my system but on rare occassions it seems to fail for 
others. I can only guess it is a timing issue of sorts, but I'm not sure I see 
how to better test this. The point of the test is not related to timing, so 
adding this extra wait doesn't seem wrong. It's not as though the functionality 
is not being tested properly. We just need to validate that the future 
completes when all the items arrive to the ResultSet, so in that sense the 
addition of the wait also validates that. CTR


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1e856b34
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1e856b34
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1e856b34

Branch: refs/heads/TINKERPOP-1602
Commit: 1e856b344849fe7db4ba2ce8e4ccdd9e0de53cb8
Parents: 9d1c3e5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jan 17 09:25:23 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jan 17 09:25:23 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/tinkerpop/gremlin/driver/ResultSetTest.java  | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1e856b34/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ResultSetTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ResultSetTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ResultSetTest.java
index 4a57ebb..0cf4fb5 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ResultSetTest.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ResultSetTest.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Stream;
@@ -76,6 +77,9 @@ public class ResultSetTest extends AbstractResultQueueTest {
         }
 
         assertThat(atLeastOnce.get(), is(true));
+
+        // ensure there is enough time for the readComplete to complete the 
"all" future
+        all.get(30000, TimeUnit.MILLISECONDS);
         assertThat(all.isDone(), is(true));
     }
 

Reply via email to