Repository navigation
Port windowing tests off WindowFnTestUtils.runWindowFn - #41724
harshilv17 wants to merge 2 commits into
Conversation
FixedWindowsTest, SlidingWindowsTest and CalendarWindowsTest now assert the windows each timestamp is assigned to with assignedWindows, so each test states where a timestamp lands, including timestamps that land in no window. SessionsTest keeps a small local helper that merges after each assignment, since merging is what it tests. runWindowFn, runWindowFnWithValue and set are public in beam-sdks-java-core, so they are deprecated rather than removed. Fixes apache#18458
There was a problem hiding this comment.
📋 Review Summary
This PR cleanly migrates FixedWindowsTest, SlidingWindowsTest, CalendarWindowsTest, and SessionsTest off WindowFnTestUtils.runWindowFn and deprecates the legacy helper methods in WindowFnTestUtils to address #18458. The refactored tests are much easier to read and explicitly assert edge cases (such as unassigned timestamps in SlidingWindowsTest.testElidings).
🔍 General Feedback
- All expected window boundaries and assigned timestamps match the previous test cases while making the per-timestamp window assignments clear and direct.
- Deprecating
runWindowFn,runWindowFnWithValue, andsetinWindowFnTestUtils(with a correspondingCHANGES.mdentry) appropriately preserves public API compatibility inbeam-sdks-java-core.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @kennknowles for label java. This pull request likely touches a core component ("core" label). Please review with scrutiny. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Fixes #18458.
Ports the windowing tests off
WindowFnTestUtils.runWindowFn, whose expected maps of windows to"T<timestamp>"strings made it hard to see what each test checks.FixedWindowsTest,SlidingWindowsTest,CalendarWindowsTest: each test now asserts the windowsassignedWindowsreturns for each timestamp. Timestamps that land in no window, like 3, 5 and 9 inSlidingWindowsTest.testElidings, are now asserted explicitly; the old map could only leave them out.SessionsTest: merging is the behavior under test, so it keeps a small local helper that assigns each timestamp, merges after each one, and returns the sessions with the timestamps they hold, compared against anImmutableMapof windows to timestamps.runWindowFn,runWindowFnWithValueandsetare public inbeam-sdks-java-core, so they are marked@Deprecated(pointing atassignedWindows) rather than removed. No other module uses them.The expected windows are the same as before: the per-timestamp assertions were generated from the old expected maps.
Ran
FixedWindowsTest,SlidingWindowsTest,CalendarWindowsTestandSessionsTest(42 tests) locally with JDK 17;spotlessCheck,checkstyleMainandcheckstyleTestare clean. Changing an expected window, or the timestamps of a session, makes the matching test fail.Fixes #18458).CHANGES.md: deprecation entry added.