Skip to content

KAFKA-20512 : Fix flakiness - same output topic is being used for all parameterized tests #22112

Merged
mjsax merged 2 commits intoapache:trunkfrom
muralibasani:KAFKA-20512
Apr 24, 2026
Merged

KAFKA-20512 : Fix flakiness - same output topic is being used for all parameterized tests #22112
mjsax merged 2 commits intoapache:trunkfrom
muralibasani:KAFKA-20512

Conversation

@muralibasani
Copy link
Copy Markdown
Contributor

@muralibasani muralibasani commented Apr 21, 2026

  • Same output topic is used for all parameterizations. Isolating them
    with creating topic prefixing with app id
  • wait for restoring task is called so that assert works for all of
    those 10 unmatched recs

Reviewers: Matthias J. Sax matthias@confluent.io

@github-actions github-actions Bot added triage PRs from the community streams tests Test fixes (including flaky tests) small Small PRs labels Apr 21, 2026
@mjsax mjsax added ci-approved and removed triage PRs from the community labels Apr 21, 2026

@BeforeEach
public void before(final TestInfo testInfo) {
public void before(final TestInfo testInfo) throws InterruptedException {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
public void before(final TestInfo testInfo) throws InterruptedException {
public void before(final TestInfo testInfo) throws Exception {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nobody will catch an exception, so using generic throws Exception is best to avoid future edits in case other exception types might get throws in the future; because nobody catches it, there is no value to declared the exact exception type.

Copy link
Copy Markdown
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Made a pass.


@BeforeEach
public void before(final TestInfo testInfo) {
public void before(final TestInfo testInfo) throws InterruptedException {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nobody will catch an exception, so using generic throws Exception is best to avoid future edits in case other exception types might get throws in the future; because nobody catches it, there is no value to declared the exact exception type.

startApplicationAndWaitUntilRunning(streams);

// Wait until restoring tasks have been started
waitForActiveRestoringTask(streams, 0, 30000);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why de we need this addition step?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After "Step 4: Restart with Restoration", added a little wait time, but deleted it now.


assertFalse(results.isEmpty(), "Should have received output records");
final Set<String> unmatchedKeys = results.stream()
.filter(kv -> kv.value != null && kv.value.endsWith("right=null"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we revers this filter, and only drop if !"probe".equals(kv.key) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added 1 more assertion. Now we verify record shapes and key based recs.

@muralibasani
Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Made a pass.

@mjsax thanks for the review. Pushed a few changes based on the comments.

@mjsax mjsax merged commit 0dad6a7 into apache:trunk Apr 24, 2026
25 checks passed
mjsax pushed a commit that referenced this pull request Apr 24, 2026
… parameterized tests (#22112)

- Same output topic is used for all parameterizations. Isolating them
with creating topic prefixing with app id
- wait for restoring task is called so that assert works for all of
those 10 unmatched recs

Reviewers: Matthias J. Sax <matthias@confluent.io>
@mjsax
Copy link
Copy Markdown
Member

mjsax commented Apr 24, 2026

Thanks for the fix. Merged to trunk and cherry-picked to 4.3 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved small Small PRs streams tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants