Skip to content

KAFKA-19738: Add unit tests for OffsetsRequestManager ListOffsets request building#22667

Open
peterzdhuang wants to merge 1 commit into
apache:trunkfrom
peterzdhuang:KAFKA-19738
Open

KAFKA-19738: Add unit tests for OffsetsRequestManager ListOffsets request building#22667
peterzdhuang wants to merge 1 commit into
apache:trunkfrom
peterzdhuang:KAFKA-19738

Conversation

@peterzdhuang

Copy link
Copy Markdown

KAFKA-19738 asks to improve OffsetsRequestManager test coverage to better
match OffsetFetcher. This adds coverage for ListOffsets request construction
and retry routing, which were previously untested:

  • testListOffsetsRequestSendsIsolationLevel — verifies the configured
    IsolationLevel is carried on the outgoing ListOffsetsRequest. Parameterized
    over both READ_COMMITTED and READ_UNCOMMITTED.
  • testListOffsetsRequestSendsTargetTimestamp — verifies the caller's target
    timestamp is carried on the request. Parameterized over EARLIEST_TIMESTAMP
    and LATEST_TIMESTAMP.
  • testListOffsetsRetriedToNewLeaderAfterMetadataUpdate — verifies that when a
    partition's leader changes after a retriable error (NOT_LEADER_OR_FOLLOWER)
    triggers a metadata update, the retried request is routed to the new leader
    rather than the stale one.

These are state-based assertions on the built request object, consistent with
the existing tests in this class.

Testing

All tests in OffsetsRequestManagerTest pass. checkstyleTest and
spotlessJavaCheck pass.

…uest building

Adds coverage for ListOffsets request construction and retry routing in
OffsetsRequestManager:
- isolation level is carried on the request (parameterized over READ_COMMITTED
  and READ_UNCOMMITTED)
- caller target timestamp is carried on the request (parameterized over
  EARLIEST_TIMESTAMP and LATEST_TIMESTAMP)
- a retry after a NOT_LEADER_OR_FOLLOWER error is routed to the new leader
  following a metadata update
@github-actions github-actions Bot added triage PRs from the community consumer tests Test fixes (including flaky tests) clients labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients consumer tests Test fixes (including flaky tests) triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant