harshilv17 opened a new pull request, #41810:
URL: https://github.com/apache/beam/pull/41810

   Fixes #41731.
   
   Ports the remaining `DoFnTester` uses in 
`sdks/java/io/iceberg/src/test/java/org/apache/beam/sdk/io/iceberg/cdc/` 
(`ApplyWatermarkColumnTest`, `ResolveChangesTest`, `LocalResolveDoFnTest`). 
`BundleLifterTest` isn't touched.
   
   - `ApplyWatermarkColumnTest`: the two exception tests now run the fn in the 
class's existing `TestPipeline` and check that `pipeline.run()` fails with a 
`PipelineExecutionException` caused by the same exception as before 
(`UnsupportedOperationException` / `IllegalArgumentException`).
   - `ResolveChangesTest` and `LocalResolveDoFnTest`: these assert on each 
output's `ValueKind` (`UPDATE_BEFORE` / `UPDATE_AFTER` / `DELETE`), its 
timestamp, and the order the fn emitted them in. A `TestPipeline` exposes 
neither the kind nor the order, so, like the `DatastoreV1Test` (#40866) and 
`ElasticsearchIOTest` (#41215) ports, their `process()` helpers now go through 
a small package-private `InProcessDoFnRunner` that runs the fn in-process with 
`DoFnRunners.simpleRunner`. It calls `@Setup`/`@Teardown` through 
`DoFnInvokers` (both fns open the catalog in `@Setup`) and returns the outputs 
as `WindowedValue`s, so `getValueKind()` and `getTimestamp()` come straight 
from what the fn emitted. Nothing goes through `ValueInSingleWindow.of(...)`, 
so the kind can't be reset to `INSERT` on the way out (that was the problem 
flagged on #40909).
   
   `sdks/java/io/iceberg` gains a `testImplementation` dependency on 
`:runners:core-java` for `DoFnRunners`. The direct runner shades its own copy 
of runners-core, so that copy can't be used here. The test assertions are 
unchanged.
   
   `./gradlew :sdks:java:io:iceberg:test --tests 
'org.apache.beam.sdk.io.iceberg.cdc.*'` passes (`ApplyWatermarkColumnTest` 4/4, 
`ResolveChangesTest` 3/3, `LocalResolveDoFnTest` 5/5). `spotlessCheck` and 
`checkstyleTest` are clean. I also changed one expected value in each class 
(the expected exception type, a `DELETE` kind, an output timestamp), checked 
that the test then fails, and changed it back.
   
   - [x] Small/focused contribution (ICLA not required).
   - [x] Mentions the issue (`Fixes #41731`).
   - [ ] `CHANGES.md`: not needed, test-only change.
   


-- 
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