dongjinleekr commented on a change in pull request #10827:
URL: https://github.com/apache/kafka/pull/10827#discussion_r655162053



##########
File path: core/src/test/scala/kafka/tools/ReplicaVerificationToolTest.scala
##########
@@ -17,14 +17,40 @@
 
 package kafka.tools
 
+import kafka.tools.ReplicaVerificationTool.ReplicaVerificationToolOptions
 import org.apache.kafka.common.TopicPartition
 import org.apache.kafka.common.message.FetchResponseData
 import org.apache.kafka.common.record.{CompressionType, MemoryRecords, 
SimpleRecord}
 import org.junit.jupiter.api.Test
-import org.junit.jupiter.api.Assertions.assertTrue
+import org.junit.jupiter.api.Assertions.{assertEquals, assertThrows, 
assertTrue}
+import kafka.utils.Exit
 
 class ReplicaVerificationToolTest {
 
+  @Test
+  def testExitWithoutBootstrapServers(): Unit = {
+    Exit.setExitProcedure {
+      (exitCode: Int, _: Option[String]) =>
+        assertEquals(1, exitCode)
+        throw new RuntimeException
+    }
+
+    try assertThrows(classOf[RuntimeException], () => new 
ReplicaVerificationToolOptions(Array("--fetch-size", "1024")))
+    finally Exit.resetExitProcedure()
+  }
+
+  @Test
+  def testConfigOptWithBootstrapServers(): Unit = {
+    val opts1 = new ReplicaVerificationToolOptions(Array("--bootstrap-server", 
"localhost:9092"))
+    assertEquals("localhost:9092", opts1.bootstrapServer)
+
+    val opts2 = new ReplicaVerificationToolOptions(Array("--broker-list", 
"127.0.0.1:9092"))
+    assertEquals("127.0.0.1:9092", opts2.bootstrapServer)
+
+    val opts3 = new ReplicaVerificationToolOptions(Array("--broker-list", 
"127.0.0.1:9092", "--bootstrap-server", "localhost:9092"))
+    assertEquals("localhost:9092", opts3.bootstrapServer)
+  }

Review comment:
       Great. :+1: 




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to