rondagostino commented on code in PR #14678:
URL: https://github.com/apache/kafka/pull/14678#discussion_r1380218928
##########
core/src/test/java/kafka/testkit/TestKitNodes.java:
##########
@@ -119,7 +101,35 @@ public TestKitNodes build() {
if (bootstrapMetadataVersion == null) {
bootstrapMetadataVersion = MetadataVersion.latest();
}
- return new TestKitNodes(clusterId, bootstrapMetadataVersion,
controllerNodes, brokerNodes);
+ String baseDirectory = TestUtils.tempDirectory("kafka_" +
clusterId).getAbsolutePath();
+ try {
+ NavigableMap<Integer, ControllerNode> controllerNodes = new
TreeMap<>();
+ for (ControllerNode.Builder controllerNodeBuilder :
controllerNodeBuilders.values()) {
+ ControllerNode controllerNode =
controllerNodeBuilder.build(baseDirectory);
+ if (controllerNodes.put(controllerNode.id(),
controllerNode) != null) {
+ throw new RuntimeException("More than one controller
claimed ID " + controllerNode.id());
+ }
+ }
+ NavigableMap<Integer, BrokerNode> brokerNodes = new
TreeMap<>();
+ for (BrokerNode.Builder brokerNodeBuilder :
brokerNodeBuilders.values()) {
+ BrokerNode brokerNode =
brokerNodeBuilder.build(baseDirectory);
+ if (brokerNodes.put(brokerNode.id(), brokerNode) != null) {
+ throw new RuntimeException("More than one broker
claimed ID " + brokerNode.id());
+ }
+ }
+ return new TestKitNodes(baseDirectory,
+ clusterId,
+ bootstrapMetadataVersion,
+ controllerNodes,
+ brokerNodes);
+ } catch (Exception e) {
Review Comment:
nit: can be `catch (RuntimeException e) {` since the code doesn't throw any
checked exceptions and the signature of this method does not declare any
checked exceptions as being potentially thrown.
##########
core/src/main/scala/kafka/tools/TestRaftServer.scala:
##########
@@ -82,13 +82,8 @@ class TestRaftServer(
() => Features.fromKRaftVersion(MetadataVersion.MINIMUM_KRAFT_VERSION))
socketServer = new SocketServer(config, metrics, time, credentialProvider,
apiVersionManager)
- val metaProperties = MetaProperties(
- clusterId = Uuid.ZERO_UUID.toString,
- nodeId = config.nodeId
- )
-
raftManager = new KafkaRaftManager[Array[Byte]](
- metaProperties,
+ Uuid.ZERO_UUID.toString,
Review Comment:
Do we want `Uuid.randomUuid.toString` instead, which is what we use in
`RaftManagerTest`?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]