chia7712 commented on code in PR #15730: URL: https://github.com/apache/kafka/pull/15730#discussion_r1567289057
########## core/src/test/scala/integration/kafka/server/KRaftClusterTest.scala: ########## @@ -74,7 +74,7 @@ class KRaftClusterTest { def testCreateClusterAndClose(): Unit = { val cluster = new KafkaClusterTestKit.Builder( new TestKitNodes.Builder(). - setNumBrokerNodes(1). + setNumBrokerNodes(1, 2). Review Comment: Why we need this change? ########## core/src/test/java/kafka/testkit/TestKitNodes.java: ########## @@ -79,9 +82,16 @@ public Builder setNumControllerNodes(int numControllerNodes) { } public Builder setNumBrokerNodes(int numBrokerNodes) { + return setNumBrokerNodes(numBrokerNodes, 1); + } + + public Builder setNumBrokerNodes(int numBrokerNodes, int disksPerBroker) { Review Comment: As it accepts another argument now, maybe we should rename it to `setBrokerNodes` ########## core/src/test/java/kafka/testkit/TestKitNodes.java: ########## @@ -90,9 +100,17 @@ public Builder setNumBrokerNodes(int numBrokerNodes) { if (!brokerNodeBuilders.isEmpty()) { nextId = brokerNodeBuilders.lastKey() + 1; } - brokerNodeBuilders.put(nextId, - new BrokerNode.Builder(). - setId(nextId)); + BrokerNode.Builder brokerNodeBuilder = new BrokerNode.Builder().setId(nextId); + // Keeping consistent behaviour for existing tests when disksPerBroker == 1 + if (disksPerBroker > 1) { + int brokerId = nextId; // this is because the lambda below requires a final + List<String> logDataDirectories = IntStream + .range(0, disksPerBroker) + .mapToObj(i -> String.format("broker_%d_data%d", brokerId, i)) + .collect(Collectors.toList()); + brokerNodeBuilder.setLogDirectories(logDataDirectories); Review Comment: could you add a ut for this change? -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org