hachikuji commented on code in PR #12513:
URL: https://github.com/apache/kafka/pull/12513#discussion_r954300741


##########
core/src/test/scala/unit/kafka/tools/StorageToolTest.scala:
##########
@@ -191,18 +191,26 @@ Found problem:
   @Test
   def testDefaultMetadataVersion(): Unit = {
     val namespace = StorageTool.parseArguments(Array("format", "-c", 
"config.props", "-t", "XcZZOzUqS4yHOjhMQB6JLQ"))
-    val mv = StorageTool.getMetadataVersion(namespace)
+    val mv = StorageTool.getMetadataVersion(namespace, "")
     assertEquals(MetadataVersion.latest().featureLevel(), mv.featureLevel(),
       "Expected the default metadata.version to be the latest version")
   }
 
+  @Test
+  def testConfiguredMetadataVersion(): Unit = {
+    val namespace = StorageTool.parseArguments(Array("format", "-c", 
"config.props", "-t", "XcZZOzUqS4yHOjhMQB6JLQ"))
+    val mv = StorageTool.getMetadataVersion(namespace, 
MetadataVersion.IBP_3_3_IV2.toString)
+    assertEquals(MetadataVersion.IBP_3_3_IV2.featureLevel(), mv.featureLevel(),
+      "Expected the default metadata.version to be 3.3-IV2")
+  }
+
   @Test
   def testMetadataVersionFlags(): Unit = {
     def parseMetadataVersion(strings: String*): MetadataVersion = {
       var args = mutable.Seq("format", "-c", "config.props", "-t", 
"XcZZOzUqS4yHOjhMQB6JLQ")
       args ++= strings
       val namespace = StorageTool.parseArguments(args.toArray)
-      StorageTool.getMetadataVersion(namespace)
+      StorageTool.getMetadataVersion(namespace, "")

Review Comment:
   This test fails because `""` is not a valid IBP. I think this gets back to 
my point about the dubious use of `""` as a sentinel. The method here expects 
`null` instead. I think we should try to be consistent.



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