Skip to content

Port BatchViewOverridesTest off DoFnTester - #41202

Merged
jrmccluskey merged 1 commit into
apache:masterfrom
harshilv17:fix/18693-batchviewoverrides-off-dofntester
Nov 11, 2026
Merged

jrmccluskey merged 1 commit into
apache:masterfrom
harshilv17:fix/18693-batchviewoverrides-off-dofntester

Conversation

@harshilv17

Copy link
Copy Markdown
Contributor

Fixes #18693.

Ports BatchViewOverridesTest off the deprecated DoFnTester.

TestPipeline doesn't fit here. These DoFns number their output by position within a bundle (ToIsmRecordForGlobalWindowDoFn counts elements, the map-like and metadata fns count per window), and the tests assert those exact positions and their order. That needs one bundle with a known input order, which a pipeline doesn't guarantee.

So, like the DatastoreV1Test port (#40866), the test gets a processBundle helper that runs the fn in-process through DoFnRunners.simpleRunner. Two additions over that helper:

  • it collects outputs per tag, because ToIsmRecordForMapLikeDoFn also writes the size and entry-set side outputs that testToIsmRecordForMapLikeDoFn checks;
  • it unwraps UserCodeException, so the two exception tests still expect the fn's own IllegalStateException and message.

The assertions themselves are unchanged. :runners:google-cloud-dataflow-java:test --tests BatchViewOverridesTest passes (10/10), and spotlessApply and checkstyleTest are clean.

  • Small/focused contribution (ICLA not required).
  • Mentions the issue (Fixes #18693).
  • CHANGES.md: not needed, test-only change.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR cleanly migrates BatchViewOverridesTest away from the deprecated DoFnTester by introducing a local processBundle helper backed by DoFnRunners.simpleRunner. Because the tested DoFns rely on deterministic within-bundle ordering and bundle-scoped index counters, running single bundles directly via DoFnRunners.simpleRunner is an appropriate choice over TestPipeline.

🔍 General Feedback

  • The BundleOutputs helper and WindowedValueMultiReceiver cleanly handle both main and side outputs (outputForSizeTag and outputForEntrySetTag).
  • Unwrapping UserCodeException via Throwables.throwIfUnchecked(e.getCause()) preserves the exact exception assertions for the negative test cases.
  • All 10 existing test cases and their assertions are faithfully preserved.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions github-actions Bot added runners dataflow size/m M: 50-249 lines changed labels Nov 11, 2026
These DoFns number their output by position within a bundle, and the
tests assert those positions, so they need one bundle with a known
input order. TestPipeline does not guarantee that, so the tests now run
each fn in-process through DoFnRunners.simpleRunner via a small
processBundle helper, the same approach as the DatastoreV1Test port.

The helper collects outputs per tag, for the map-like fn's side outputs,
and unwraps UserCodeException so the two exception tests keep expecting
the fn's own IllegalStateException.

Fixes apache#18693
@harshilv17
harshilv17 force-pushed the fix/18693-batchviewoverrides-off-dofntester branch from 3713ec0 to ffbac04 Compare November 11, 2026 09:38
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @jrmccluskey added as fallback since no labels match configuration
Backup reviewer: shunping (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@jrmccluskey jrmccluskey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jrmccluskey
jrmccluskey merged commit c3bcccf into apache:master Nov 11, 2026
15 checks passed
@harshilv17 harshilv17 mentioned this pull request Nov 11, 2026
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port BatchViewOverridesTest off DoFnTester

2 participants