beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [2/3] incubator-beam git commit: Fix erroneous test in CombineTest
Date Wed, 20 Apr 2016 23:41:49 GMT
Fix erroneous test in CombineTest

The test modified was never run, so we never learned that it was
incorrect. This change activates the test and fixes it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/aecf7069
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/aecf7069
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/aecf7069

Branch: refs/heads/master
Commit: aecf7069a1a38845a883a226a1547320e5ae51af
Parents: 4c9dd22
Author: Kenneth Knowles <klk@google.com>
Authored: Wed Apr 20 13:12:48 2016 -0700
Committer: Kenneth Knowles <klk@google.com>
Committed: Wed Apr 20 16:41:14 2016 -0700

----------------------------------------------------------------------
 .../org/apache/beam/sdk/transforms/CombineTest.java   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/aecf7069/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
index 38961ed..9fa148e 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
@@ -20,8 +20,10 @@ package org.apache.beam.sdk.transforms;
 import static org.apache.beam.sdk.TestUtils.checkCombineFn;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.hasDisplayItem;
 import static org.apache.beam.sdk.transforms.display.DisplayDataMatchers.includes;
+
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import static org.hamcrest.Matchers.hasItem;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
@@ -389,7 +391,17 @@ public class CombineTest implements Serializable {
         .apply(Sum.integersGlobally())
         .apply(ParDo.of(new FormatPaneInfo()));
 
-    PAssert.that(output).containsInAnyOrder("1: false", "2: true");
+    // The actual elements produced are nondeterministic. Could be one, could be two.
+    // But it should certainly have a final element with the correct final sum.
+    PAssert.that(output).satisfies(new SerializableFunction<Iterable<String>, Void>()
{
+      @Override
+      public Void apply(Iterable<String> input) {
+        assertThat(input, hasItem("2: true"));
+        return null;
+      }
+    });
+
+    pipeline.run();
   }
 
   @Test


Mime
View raw message