mxtymoshyk opened a new issue, #40288:
URL: https://github.com/apache/beam/issues/40288

   ### What happened?
   
   `PulsarIOTest.testRead` fails intermittently in 
`beam_PreCommit_Java_Pulsar_IO_Direct`, including on PRs that don't touch the 
Pulsar read path.
   
   Example run: 
https://github.com/apache/beam/actions/runs/36177336523/job/108211025016
   
   ```
   PulsarIOTest > testRead FAILED
       java.lang.AssertionError: MapElements/Map/ParMultiDo(Anonymous).output: 
arrays first differed at element [0]; expected:<1> but was:<0>
   ```
   
   The test checks that the output arrives in order: 
https://github.com/apache/beam/blob/011e1b33e24b0eb68be225e4e4f845348d6c57bd/sdks/java/io/pulsar/src/test/java/org/apache/beam/sdk/io/pulsar/PulsarIOTest.java#L61-L69
   
   ```java
   Assert.assertArrayEquals(result.toArray(), new Integer[] {0, 1, 2, 3, 4, 5, 
6, 7, 8, 9});
   ```
   
   A `PCollection` has no order, and `PAssert` passes the elements through a 
GroupByKey. On a slow runner, the DirectRunner checkpoints the splittable DoFn 
after about 1s, so the remaining messages come out in a later bundle. The data 
itself is complete: the error has no "array lengths differed" text, so all 10 
elements arrived. Only the order changed. Because the arguments to 
`assertArrayEquals` are swapped, "expected:<1>" is actually the first element 
that arrived.
   
   Proposed fix:
   
   ```java
   PAssert.that(pcoll).containsInAnyOrder(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
   ```
   
   The order-sensitive assertion was added in #36141, which closed the earlier 
flake issues #21714 and #21560.
   
   ### Issue Failure
   
   Failure: Test is flaky
   
   ### Issue Priority
   
   Priority: 2 (backlog / disabled test but we think the product is healthy)
   
   ### Issue Components
   
   - [x] Component: Java SDK
   - [x] Component: IO connector
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to