chia7712 commented on code in PR #17225:
URL: https://github.com/apache/kafka/pull/17225#discussion_r1771528836


##########
core/src/test/java/kafka/testkit/KafkaClusterTestKitTest.java:
##########
@@ -122,4 +126,25 @@ public void 
testCreateClusterAndCloseWithMultipleLogDirs(boolean combined) {
             fail("failed to init cluster", e);
         }
     }
+
+    @Test
+    public void testCreateClusterWithSpecificBaseDir() {
+        Path baseDirectory = TestUtils.tempDirectory().toPath();
+        try (KafkaClusterTestKit cluster = new KafkaClusterTestKit.Builder(
+                new TestKitNodes.Builder().
+                        setBaseDirectory(baseDirectory).
+                        setNumBrokerNodes(1).
+                        setCombined(true).
+                        setNumControllerNodes(1).build()).build()) {
+            assertEquals(cluster.nodes().baseDirectory(), 
baseDirectory.toFile().getAbsolutePath());
+            cluster.nodes().controllerNodes().values().forEach(controller -> {
+                
assertTrue(Paths.get(controller.metadataDirectory()).startsWith(baseDirectory));
+            });
+            cluster.nodes().brokerNodes().values().forEach(broker -> {
+                
assertTrue(Paths.get(broker.metadataDirectory()).startsWith(baseDirectory));
+            });
+        } catch (Exception e) {

Review Comment:
   yes, please do a bit refactor :)



-- 
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

Reply via email to