Skip to content

MINOR: Flaky test fixes#21986

Merged
chia7712 merged 2 commits intoapache:trunkfrom
AndrewJSchofield:flaky-test-fixes
Apr 14, 2026
Merged

MINOR: Flaky test fixes#21986
chia7712 merged 2 commits intoapache:trunkfrom
AndrewJSchofield:flaky-test-fixes

Conversation

@AndrewJSchofield
Copy link
Copy Markdown
Member

@AndrewJSchofield AndrewJSchofield commented Apr 7, 2026

Fixes a couple of flaky tests.

Reviewers: Chia-Ping Tsai chia7712@gmail.com, Apoorv Mittal
apoorvmittal10@gmail.com

} catch (Exception e) {
if (!(e instanceof GroupAuthorizationException || e instanceof TopicAuthorizationException || e instanceof InvalidTopicException))
if (!(e instanceof GroupAuthorizationException || e instanceof TopicAuthorizationException
|| e instanceof InvalidTopicException || e instanceof UnknownServerException))
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.

Is this intended as a bug fix? the exception thrown by processBackgroundEventsOnClose will be handled by swallow

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's true, but it will then set firstException in ShareConsumerImpl.close(Duration, boolean) and the exception will eventually be thrown by that method.

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.

Out of curiosity, since we are swallowing UnknownServerException in processBackgroundEventsOnClose, shouldn't we do the same in sendAcknowledgementsAndLeaveGroup for consistency? Both are steps in the close sequence.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I was thinking that. There's no hurry to get this into 4.3 because it just fixes a minimally flaky test. I'll spend a bit more time here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've decided to revert this part of the PR. Although it makes a test reliable, really the fix should be to stop the broker returning the unknown server error.

Copy link
Copy Markdown
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

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

LGTM, agree that the exception swallow is marked false when the client is instatiated correctly oterwise it will fail with original exception.

@github-actions github-actions bot added the tests Test fixes (including flaky tests) label Apr 13, 2026
@chia7712 chia7712 merged commit 4acdac6 into apache:trunk Apr 14, 2026
22 checks passed
@AndrewJSchofield AndrewJSchofield deleted the flaky-test-fixes branch April 14, 2026 08:06
nileshkumar3 pushed a commit to nileshkumar3/kafka that referenced this pull request Apr 15, 2026
Fixes a couple of flaky tests.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Apoorv Mittal
 <apoorvmittal10@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved clients consumer small Small PRs tests Test fixes (including flaky tests) tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants