Skip to content

KAFKA-20545: Fix flaky MirrorConnectorsIntegrationSSLTest testConnectorMetrics* tests#22291

Merged
mimaison merged 2 commits into
apache:trunkfrom
nileshkumar3:KAFKA-20545
May 18, 2026
Merged

KAFKA-20545: Fix flaky MirrorConnectorsIntegrationSSLTest testConnectorMetrics* tests#22291
mimaison merged 2 commits into
apache:trunkfrom
nileshkumar3:KAFKA-20545

Conversation

@nileshkumar3
Copy link
Copy Markdown
Contributor

@nileshkumar3 nileshkumar3 commented May 15, 2026

Clear the static CollectAllMetricsReporter.METRICS map in @AfterEach
and at the start of testConnectorMetrics so metric counts are not
polluted by prior tests in the same JVM.

Fixes flaky failures where assertMetrics never reached the expected
156 source / 4 checkpoint metrics and waitForCondition timed out with
"Unable to find the MirrorMaker metrics".

Reviewers: Mickael Maison mickael.maison@gmail.com, Murali Basani
muralidhar.basani@aiven.io

@github-actions github-actions Bot added triage PRs from the community connect tests Test fixes (including flaky tests) mirror-maker-2 small Small PRs labels May 15, 2026
}

private void testConnectorMetrics(String format, Supplier<Boolean> assertions) throws InterruptedException, ExecutionException {
CollectAllMetricsReporter.METRICS.clear();
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.

I think this is redundant with afterEach ?

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.

You're right, it is redundant. @AfterEach clears METRICS after every test, so by the time testConnectorMetrics runs the map is already empty. Removed the clear from testConnectorMetrics and kept only the @AfterEach one.

Copy link
Copy Markdown
Contributor Author

@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.

@muralibasani Thanks for reviewing the PR. I fixed the review comment, Please look when you get a chance.

Copy link
Copy Markdown
Contributor

@muralibasani muralibasani left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@nileshkumar3
Copy link
Copy Markdown
Contributor Author

@mimaison could you please review when get a chance.

@github-actions github-actions Bot removed the triage PRs from the community label May 18, 2026
Copy link
Copy Markdown
Member

@mimaison mimaison left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR

@mimaison mimaison merged commit d55e0cb into apache:trunk May 18, 2026
27 checks passed
@nileshkumar3
Copy link
Copy Markdown
Contributor Author

LGTM, thanks.

Thanks for the review.

@nileshkumar3
Copy link
Copy Markdown
Contributor Author

@mimaison could you please review when get a chance.

Thanks for the review.

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

Labels

ci-approved connect mirror-maker-2 small Small PRs tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants