Skip to content

KAFKA-20323: Refactor deleteRecords stub to use partition-based matching for Mockito upgrade#21857

Open
ChoMinGi wants to merge 1 commit intoapache:trunkfrom
ChoMinGi:kafka-20323-mockito-refactor
Open

KAFKA-20323: Refactor deleteRecords stub to use partition-based matching for Mockito upgrade#21857
ChoMinGi wants to merge 1 commit intoapache:trunkfrom
ChoMinGi:kafka-20323-mockito-refactor

Conversation

@ChoMinGi
Copy link
Copy Markdown

@ChoMinGi ChoMinGi commented Mar 24, 2026

testRecordPruningTaskPeriodicityWithSomeFailures fails with Mockito 5.21+ because
unstubbed CompletableFuture methods now return completedFuture(null) instead of null, so unstubbed deleteRecords calls succeed instead of being no-ops.

Changed deleteRecords stubs from offset-based matching to partition-based matching, which better reflects the test intent (tp1 succeeds, tp2 fails) and removes dependency on Mockito's default return behavior.

Upgraded Mockito from 5.20.0 to 5.23.0 as the issue description allows 5.21.0 or more recent versions.
Verified locally that both 5.21.0 and 5.23.0 pass all ShareCoordinatorServiceTest tests.

…ing for Mockito upgrade

- Change deleteRecords stubs from offset-based to partition-based matching
- Upgrade Mockito from 5.20.0 to 5.23.0
@github-actions github-actions bot added triage PRs from the community KIP-932 Queues for Kafka build Gradle build or GitHub Actions small Small PRs labels Mar 24, 2026
Copy link
Copy Markdown
Contributor

@nileshkumar3 nileshkumar3 left a comment

Choose a reason for hiding this comment

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

LGTM. Partition + anyLong() matches the real intent (tp1 succeeds, tp2 fails) and avoids relying on Mockito’s default for unstubbed CompletableFuture return types after 5.21+. The failure mode (second prune uses new offsets 11/21, so offset-only stubs no longer matched) is clear.

@ChoMinGi
Copy link
Copy Markdown
Author

@nileshkumar3 Thanks for the review :)

@github-actions github-actions bot removed the triage PRs from the community label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions KIP-932 Queues for Kafka small Small PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants