soarez commented on code in PR #15834: URL: https://github.com/apache/kafka/pull/15834#discussion_r1627976190
########## 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) Review Comment: This property is ignored in KRaft. It assumes the value of `MINIMUM_KRAFT_VERSION` and cannot be set. https://github.com/apache/kafka/blob/f2aafcc66faca4d07a27e4ef90158136cb317b44/core/src/main/scala/kafka/server/KafkaConfig.scala#L896-L914 So I don't think we need to test this? What test did you have in mind? -- 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