soarez commented on code in PR #15834:
URL: https://github.com/apache/kafka/pull/15834#discussion_r1627855813


##########
core/src/test/scala/unit/kafka/tools/StorageToolTest.scala:
##########
@@ -656,5 +657,47 @@ Found problem:
       assertEquals(1, exitStatus)
     }
   }
+
+  @Test
+  def testFormatValidatesConfigForMetadataVersion(): Unit = {
+    val config = Mockito.spy(new KafkaConfig(TestUtils.createBrokerConfig(10, 
null)))
+    val args = Array("format",
+      "-c", "dummy.properties",
+      "-t", "XcZZOzUqS4yHOjhMQB6JLQ",
+      "--release-version", MetadataVersion.LATEST_PRODUCTION.toString)
+    val exitCode = 
StorageTool.runFormatCommand(StorageTool.parseArguments(args), config)
+    Mockito.verify(config, 
Mockito.times(1)).validateWithMetadataVersion(MetadataVersion.LATEST_PRODUCTION)
+    assertEquals(0, exitCode)
+  }
+
+  private def createPropsFile(properties: Properties): String = {
+    val propsFile = TestUtils.tempFile()
+    val propsStream = Files.newOutputStream(propsFile.toPath)
+    try {
+      properties.store(propsStream, "config.props")
+    } finally {
+      propsStream.close()
+    }
+    propsFile.toPath.toString
+  }
+
+  @Test
+  def testJbodSupportValidation(): Unit = {
+    def formatWith(logDirCount: Int, metadataVersion: MetadataVersion): 
Integer = {
+      val properties = TestUtils.createBrokerConfig(10, null, logDirCount = 
logDirCount)
+      
properties.remove(ReplicationConfigs.INTER_BROKER_PROTOCOL_VERSION_CONFIG)
+      StorageTool.runMain(Array("format",

Review Comment:
   Makes sense



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

Reply via email to