You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/12/10 19:10:29 UTC
[GitHub] [kafka] jsancio commented on a change in pull request #11593: KAFKA-13528: KRaft RegisterBroker should validate that the cluster ID matches
jsancio commented on a change in pull request #11593:
URL: https://github.com/apache/kafka/pull/11593#discussion_r766913504
##########
File path: metadata/src/test/java/org/apache/kafka/controller/ClusterControlManagerTest.java
##########
@@ -84,6 +90,27 @@ public void testReplay() {
assertTrue(clusterControl.unfenced(1));
}
+ @Test
+ public void testRegistrationWithIncorrectClusterId() throws Exception {
+ SnapshotRegistry snapshotRegistry = new SnapshotRegistry(new LogContext());
+ ClusterControlManager clusterControl = new ClusterControlManager(
+ new LogContext(), "fPZv1VBsRFmnlRvmGcOW9w", new MockTime(0, 0, 0),
+ snapshotRegistry, 1000,
+ new StripedReplicaPlacer(new Random()), new MockControllerMetrics());
+ clusterControl.activate();
+ try {
+ clusterControl.registerBroker(new BrokerRegistrationRequestData().
+ setClusterId("WIjw3grwRZmR2uOpdpVXbg").
+ setBrokerId(0).
+ setRack(null).
+ setIncarnationId(Uuid.fromString("0H4fUu1xQEKXFYwB1aBjhg")),
+ 123L,
+ new FeatureMapAndEpoch(new FeatureMap(Collections.emptyMap()), 456L));
+ Assertions.fail("Expected exception");
Review comment:
Did you consider using `Assertion.assertThrows`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org