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

   Fixes #18688.
   
   Ports the Elasticsearch write tests in `ElasticsearchIOTestCommon` off the 
deprecated `DoFnTester`.
   
   `TestPipeline` doesn't fit here either: as the existing comments say, bundle 
size is the runner's decision, and `testWriteWithMaxBatchSize` / 
`testWriteWithMaxBatchSizeBytes` check how many documents Elasticsearch holds 
between elements of the same bundle.
   
   So, like the `DatastoreV1Test` (#40866) and `BatchViewOverridesTest` 
(#41202) ports, the four tests now use a small `BulkIOBundleFnRunner` that runs 
`BulkIOBundleFn` in-process through `DoFnRunners.simpleRunner`. What differs 
from those helpers:
   
   - `BulkIOBundleFn` creates its REST client in `@Setup` and closes it in 
`@Teardown`, so the helper invokes both through `DoFnInvokers`.
   - Like `DoFnTester`, a bundle starts on the first element and finishes at 
the end of `processBundle` or on `close()`, so the tests that feed elements one 
at a time keep their semantics.
   - It unwraps `UserCodeException`, so `testWriteWithErrors` still matches the 
fn's own exception message.
   
   `elasticsearch-tests-common` gains an `implementation` dependency on 
`:runners:core-java` for `DoFnRunners`. The test assertions are unchanged.
   
   Ran locally against Elasticsearch 8 (testcontainers): `testWriteWithErrors`, 
`testWriteWithAllowableErrors`, `testWriteWithMaxBatchSize` and 
`testWriteWithMaxBatchSizeBytes` pass. `spotlessApply` and `checkstyleMain` are 
clean.
   
   - [x] Small/focused contribution (ICLA not required).
   - [x] Mentions the issue (`Fixes #18688`).
   - [ ] `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]

  • [PR] Port ElasticsearchIOTest ... harshilv17 (via GitHub) via github

Reply via email to