Mark one of the Peer Pressure tests as non-deterministic. This test tends to fail on certain systems like Travis. By marking it as non-deterministic it will only run when a special system variable is included with the build. CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/061a2d4a Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/061a2d4a Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/061a2d4a Branch: refs/heads/TINKERPOP-1545-tp32 Commit: 061a2d4ad6cc4545c294a09ee13fcfb751139adb Parents: b249301 Author: Stephen Mallette <[email protected]> Authored: Tue Jan 3 13:48:04 2017 -0500 Committer: Stephen Mallette <[email protected]> Committed: Tue Jan 3 13:48:04 2017 -0500 ---------------------------------------------------------------------- .../gremlin/server/GremlinServerIntegrateTest.java | 4 ++-- .../org/apache/tinkerpop/gremlin/TestHelper.java | 16 ++++++++++++++++ .../traversal/step/map/PeerPressureTest.java | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/061a2d4a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java ---------------------------------------------------------------------- diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 420bd05..1743e89 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java @@ -27,6 +27,7 @@ import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.log4j.Logger; +import org.apache.tinkerpop.gremlin.TestHelper; import org.apache.tinkerpop.gremlin.driver.Client; import org.apache.tinkerpop.gremlin.driver.Cluster; import org.apache.tinkerpop.gremlin.driver.Result; @@ -378,8 +379,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration // the highwatermark should get exceeded on the server and thus pause the writes, but have no problem catching // itself up - this is a tricky tests to get passing on all environments so this assumption will deny the // test for most cases - assumeThat("Set the 'assertNonDeterministic' property to true to execute this test", - System.getProperty("assertNonDeterministic"), is("true")); + TestHelper.assumeNonDeterministic(); final Cluster cluster = TestClientFactory.open(); final Client client = cluster.connect(); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/061a2d4a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java index 1432b7d..382c39d 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java @@ -41,8 +41,10 @@ import java.util.Random; import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assume.assumeThat; /** * Utility methods for test development. @@ -174,6 +176,20 @@ public final class TestHelper { return cleaned; } + /** + * Used at the start of a test to make it one that should only be executed when the {@code assertNonDeterministic} + * system property is set to {@code true}. Tests that call this method are ones that may sometimes fail in certain + * environments or behave in other random ways. Usually such tests should be removed or re-worked, but there are + * situations where that may not be possible as there is no other good way to test the feature. In these cases, the + * tests won't fail a standard build. For this benefit, the downside is that the feature isn't tested as often as + * it would otherwise, since the {@code assertNonDeterministic} option is not used often and definitely not in + * automated builds like Travis. + */ + public static void assumeNonDeterministic() { + assumeThat("Set the 'assertNonDeterministic' property to true to execute this test", + System.getProperty("assertNonDeterministic"), is("true")); + } + /////////////// public static void validateVertexEquality(final Vertex originalVertex, final Vertex otherVertex, boolean testEdges) { http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/061a2d4a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java index 5a2477c..996be6d 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java @@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map; import org.apache.tinkerpop.gremlin.LoadGraphWith; +import org.apache.tinkerpop.gremlin.TestHelper; import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest; import org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; @@ -80,6 +81,7 @@ public abstract class PeerPressureTest extends AbstractGremlinProcessTest { @Test @LoadGraphWith(MODERN) public void g_V_hasXname_rippleX_inXcreatedX_peerPressure_byXoutEX_byXclusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX() { + TestHelper.assumeNonDeterministic(); final Traversal<Vertex, Map<String, List<Object>>> traversal = get_g_V_hasXname_rippleX_inXcreatedX_peerPressure_byXoutEX_byXclusterX_repeatXunionXidentity__bothX_timesX2X_dedup_valueMapXname_clusterX(); printTraversalForm(traversal); final List<Map<String, List<Object>>> results = traversal.toList();
