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

   Fixes #41729.
   
   Ports the last two Datastore tests in `sdks/java/io/google-cloud-platform` 
off the deprecated `DoFnTester`.
   
   `TestPipeline` doesn't fit `RampupThrottlingFnTest`: the test fixes the Joda 
clock, injects a sleeper and a Mockito counter that can't be serialized, and 
checks how many elements of one bundle go through before the fn throttles. So, 
like the `DatastoreV1Test` port (#40866), it now runs `RampupThrottlingFn` 
through `DoFnRunners.simpleRunner`. What differs from that helper:
   
   - The fn reads a side input, so the runner gets a small `SideInputReader` 
that returns the fixed start time for the start-time view.
   - `simpleRunner` doesn't call `@Setup`, so the test calls `setup()` itself 
and then injects the sleeper and counter. This replaces the anonymous subclass 
that overrode `setup()`.
   - `simpleRunner` wraps user exceptions in `UserCodeException`, so the 
throttling check now asserts a `UserCodeException` caused by 
`RampupDelayException`.
   
   The rampup schedule and the expected counts are unchanged.
   
   `SplitQueryFnIT` now uses `TestPipeline` + `PAssert`: `Create` the query, 
`ParDo(SplitQueryFn)`, `Count.globally()`, and `PAssert.thatSingleton` on the 
expected number of splits, once without and once with `readTime`.
   
   Ran locally (JDK 17): `RampupThrottlingFnTest` passes. I also changed one 
expected count to check the test fails, then reverted it. `compileTestJava`, 
`checkstyleTest` and `spotlessApply` are clean. `SplitQueryFnIT` needs real 
Datastore in `apache-beam-testing`, so I only compiled it.
   
   - [x] Small/focused contribution (ICLA not required).
   - [x] Mentions the issue (`Fixes #41729`).
   - [ ] `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 RampupThrottlingFnTe... harshilv17 (via GitHub) via github

Reply via email to