jolshan commented on code in PR #16973:
URL: https://github.com/apache/kafka/pull/16973#discussion_r1739491401
##########
core/src/test/scala/unit/kafka/tools/StorageToolTest.scala:
##########
@@ -433,5 +433,95 @@ Found problem:
contains("Formatting dynamic metadata voter directory
%s".format(availableDirs.head)),
"Failed to find content in output: " + stream.toString())
}
-}
+ private def runVersionMappingCommand(
+ stream: ByteArrayOutputStream,
+ releaseVersion: String
+ ): Int = {
+ val tempDir = TestUtils.tempDir()
+ try {
+ // Prepare the arguments list
+ val arguments = ListBuffer[String]("version-mapping")
+
+ // Add the release version argument
+ if (releaseVersion != null) {
+ arguments += "--release-version"
+ arguments += releaseVersion
+ }
+
+ // Execute the StorageTool with the arguments
+ StorageTool.execute(arguments.toArray, new PrintStream(stream))
+
+ } finally {
+ Utils.delete(tempDir)
+ }
+ }
+
+ @Test
+ def testVersionMappingWithValidReleaseVersion(): Unit = {
+ val stream = new ByteArrayOutputStream()
+ // Test with a valid release version
+ assertEquals(0, runVersionMappingCommand(stream, "3.3-IV3"))
+
+ val output = stream.toString()
+ assertTrue(output.contains("metadata.version=7 (3.3-IV3)"),
Review Comment:
small nit: should we iterate through all the features and not hard code
them? It shouldn't be too bad since the the values should all be 0.
--
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]