Skip to content

Conversation

@apalan60
Copy link
Contributor

@apalan60 apalan60 commented Aug 11, 2025

Fixes a false positive in BrokerRegistrationRequestTest caused by
isMigratingZkBroker, and migrates the test from Scala to Java.

Reviewers: Chia-Ping Tsai chia7712@gmail.com

@github-actions github-actions bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) labels Aug 11, 2025
Comment on lines 155 to 163
// No features (MV) sent with registration, controller can't verify
assertEquals(
Errors.BROKER_ID_NOT_REGISTERED,
registerBroker(channelManager, clusterId, 100, Some(1), None))
Errors.INVALID_REGISTRATION,
registerBroker(channelManager, clusterId, 100, None, None))

// Given MV is too high for controller to support
assertEquals(
Errors.BROKER_ID_NOT_REGISTERED,
registerBroker(channelManager, clusterId, 100, Some(1), Some((MetadataVersion.IBP_3_4_IV0.featureLevel, MetadataVersion.IBP_3_4_IV0.featureLevel))))
Errors.UNSUPPORTED_VERSION,
registerBroker(channelManager, clusterId, 100, None, Some((MetadataVersion.IBP_3_4_IV0.featureLevel, MetadataVersion.IBP_3_4_IV0.featureLevel))))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, passing Some(1) as the zkEpoch parameter caused zkEpoch.isDefined to always be true, which led to a BrokerIdNotRegisteredException being thrown.
As a result, the intended test scenario was never actually tested.

@github-actions github-actions bot removed the triage PRs from the community label Aug 12, 2025
Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@apalan60 thanks for this migration. I leave a couple of comments

@apalan60
Copy link
Contributor Author

@chia7712
Thanks for the review! All comments addressed.

return new NodeToControllerChannelManagerImpl(
new TestControllerNodeProvider(controllerSocketServer, clusterInstance),
Time.SYSTEM,
new Metrics(),
Copy link
Member

Choose a reason for hiding this comment

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

Could you please close the metrics manually? NodeToControllerChannelManagerImpl does not handle it.

@apalan60
Copy link
Contributor Author

@chia7712
Updated again based on the latest feedback. Thanks!

@apalan60
Copy link
Contributor Author

Seems the refactored test is causing a thread leak. I’m looking into a fix.

return Errors.forCode(resp.data().errorCode());
}

record FeatureLevel(short min, short max) { }
Copy link
Member

Choose a reason for hiding this comment

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

this could be replaced by BrokerRegistrationRequestData.Feature, shouldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed this, thanks.

Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

LGTM

@chia7712 chia7712 merged commit bf0e6ba into apache:trunk Aug 16, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-approved core Kafka Broker tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants