chia7712 commented on code in PR #17836:
URL: https://github.com/apache/kafka/pull/17836#discussion_r1858635244
##########
core/src/test/scala/unit/kafka/tools/StorageToolTest.scala:
##########
@@ -483,20 +483,44 @@ Found problem:
Seq("--release-version", "3.9-IV0"))).getMessage)
}
- @Test
- def testFormatWithNoInitialControllersSucceedsOnController(): Unit = {
+ @ParameterizedTest
+ @ValueSource(booleans = Array(false, true))
+ def
testFormatWithNoInitialControllersSucceedsOnController(setKraftVersionFeature:
Boolean): Unit = {
val availableDirs = Seq(TestUtils.tempDir())
val properties = new Properties()
properties.putAll(defaultDynamicQuorumProperties)
properties.setProperty("log.dirs", availableDirs.mkString(","))
val stream = new ByteArrayOutputStream()
- assertEquals(0, runFormatCommand(stream, properties,
- Seq("--no-initial-controllers", "--release-version", "3.9-IV0")))
+ val arguments = ListBuffer[String]("--release-version", "3.9-IV0",
"--no-initial-controllers")
+ if (setKraftVersionFeature) {
+ arguments += "--feature"
+ arguments += "kraft.version=1"
+ }
+ assertEquals(0, runFormatCommand(stream, properties, arguments.toSeq))
assertTrue(stream.toString().
contains("Formatting metadata directory %s".format(availableDirs.head)),
"Failed to find content in output: " + stream.toString())
}
+ @Test
+ def testFormatWithNoInitialControllersFlagAndStandaloneFlagFails(): Unit = {
+ val arguments = ListBuffer[String](
+ "--release-version", "3.9-IV0",
+ "--no-initial-controllers", "--standalone")
+ assertThrows(classOf[ArgumentParserException], () =>
StorageTool.parseArguments(arguments.toArray))
Review Comment:
please check the exception message as well
##########
core/src/test/scala/unit/kafka/tools/StorageToolTest.scala:
##########
@@ -483,20 +483,44 @@ Found problem:
Seq("--release-version", "3.9-IV0"))).getMessage)
}
- @Test
- def testFormatWithNoInitialControllersSucceedsOnController(): Unit = {
+ @ParameterizedTest
+ @ValueSource(booleans = Array(false, true))
+ def
testFormatWithNoInitialControllersSucceedsOnController(setKraftVersionFeature:
Boolean): Unit = {
val availableDirs = Seq(TestUtils.tempDir())
val properties = new Properties()
properties.putAll(defaultDynamicQuorumProperties)
properties.setProperty("log.dirs", availableDirs.mkString(","))
val stream = new ByteArrayOutputStream()
- assertEquals(0, runFormatCommand(stream, properties,
- Seq("--no-initial-controllers", "--release-version", "3.9-IV0")))
+ val arguments = ListBuffer[String]("--release-version", "3.9-IV0",
"--no-initial-controllers")
+ if (setKraftVersionFeature) {
+ arguments += "--feature"
+ arguments += "kraft.version=1"
+ }
+ assertEquals(0, runFormatCommand(stream, properties, arguments.toSeq))
assertTrue(stream.toString().
contains("Formatting metadata directory %s".format(availableDirs.head)),
"Failed to find content in output: " + stream.toString())
}
+ @Test
+ def testFormatWithNoInitialControllersFlagAndStandaloneFlagFails(): Unit = {
+ val arguments = ListBuffer[String](
+ "--release-version", "3.9-IV0",
+ "--no-initial-controllers", "--standalone")
+ assertThrows(classOf[ArgumentParserException], () =>
StorageTool.parseArguments(arguments.toArray))
+ }
+
+ @Test
+ def testFormatWithNoInitialControllersFlagAndInitialControllersFlagFails():
Unit = {
+ val arguments = ListBuffer[String](
+ "--release-version", "3.9-IV0",
Review Comment:
ditto
##########
core/src/test/scala/unit/kafka/tools/StorageToolTest.scala:
##########
@@ -483,20 +483,44 @@ Found problem:
Seq("--release-version", "3.9-IV0"))).getMessage)
}
- @Test
- def testFormatWithNoInitialControllersSucceedsOnController(): Unit = {
+ @ParameterizedTest
+ @ValueSource(booleans = Array(false, true))
+ def
testFormatWithNoInitialControllersSucceedsOnController(setKraftVersionFeature:
Boolean): Unit = {
val availableDirs = Seq(TestUtils.tempDir())
val properties = new Properties()
properties.putAll(defaultDynamicQuorumProperties)
properties.setProperty("log.dirs", availableDirs.mkString(","))
val stream = new ByteArrayOutputStream()
- assertEquals(0, runFormatCommand(stream, properties,
- Seq("--no-initial-controllers", "--release-version", "3.9-IV0")))
+ val arguments = ListBuffer[String]("--release-version", "3.9-IV0",
"--no-initial-controllers")
+ if (setKraftVersionFeature) {
+ arguments += "--feature"
+ arguments += "kraft.version=1"
+ }
+ assertEquals(0, runFormatCommand(stream, properties, arguments.toSeq))
assertTrue(stream.toString().
contains("Formatting metadata directory %s".format(availableDirs.head)),
"Failed to find content in output: " + stream.toString())
}
+ @Test
+ def testFormatWithNoInitialControllersFlagAndStandaloneFlagFails(): Unit = {
+ val arguments = ListBuffer[String](
+ "--release-version", "3.9-IV0",
Review Comment:
please add "format" to match the test case
--
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]