This is an automated email from the ASF dual-hosted git repository.
Abacn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 6f0047c13a7 Make PulsarIOTest.testRead order-independent (#40290)
6f0047c13a7 is described below
commit 6f0047c13a7e1e82b903313c45cdc0a0f9c22dc3
Author: Maksym Tymoshyk <[email protected]>
AuthorDate: Sat Sep 26 05:31:36 2026 +0300
Make PulsarIOTest.testRead order-independent (#40290)
A PCollection has no order, and PAssert hands elements through a GroupByKey,
so asserting the exact array order fails whenever the DirectRunner splits
the
read into several bundles. Use containsInAnyOrder instead.
Fixes #40288
---
.../java/org/apache/beam/sdk/io/pulsar/PulsarIOTest.java | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git
a/sdks/java/io/pulsar/src/test/java/org/apache/beam/sdk/io/pulsar/PulsarIOTest.java
b/sdks/java/io/pulsar/src/test/java/org/apache/beam/sdk/io/pulsar/PulsarIOTest.java
index c33e97ab4ad..842d49b9c70 100644
---
a/sdks/java/io/pulsar/src/test/java/org/apache/beam/sdk/io/pulsar/PulsarIOTest.java
+++
b/sdks/java/io/pulsar/src/test/java/org/apache/beam/sdk/io/pulsar/PulsarIOTest.java
@@ -19,8 +19,6 @@ package org.apache.beam.sdk.io.pulsar;
import java.io.Serializable;
import java.time.Instant;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.beam.sdk.testing.PAssert;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.transforms.MapElements;
@@ -58,15 +56,7 @@ public class PulsarIOTest implements Serializable {
.apply(
MapElements.into(TypeDescriptor.of(Integer.class))
.via(m -> (int) m.getMessageId()[1]));
- PAssert.that(pcoll)
- .satisfies(
- iterable -> {
- List<Integer> result = new ArrayList<Integer>();
- iterable.forEach(result::add);
- Assert.assertArrayEquals(
- result.toArray(), new Integer[] {0, 1, 2, 3, 4, 5, 6, 7, 8,
9});
- return null;
- });
+ PAssert.that(pcoll).containsInAnyOrder(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
pipeline.run();
}