17hao commented on a change in pull request #9891: URL: https://github.com/apache/kafka/pull/9891#discussion_r559946390
########## File path: core/src/test/scala/unit/kafka/tools/DumpLogSegmentsTest.scala ########## @@ -168,6 +168,19 @@ class DumpLogSegmentsTest { assertEquals(Map.empty, errors.shallowOffsetNotFound) } + @Test + def testDumpEmptyIndex(): Unit = { + val indexFile = new File(indexFilePath) + new PrintWriter(indexFile).close() + val expectOutput = s"$indexFile is empty.\n" + val outContent = new ByteArrayOutputStream() + Console.withOut(outContent) { + DumpLogSegments.dumpIndex(indexFile, indexSanityOnly = false, verifyOnly = true, + misMatchesForIndexFilesMap = mutable.Map[String, List[(Long, Long)]](), Int.MaxValue) + } + assertEquals(outContent.toString, expectOutput) Review comment: My bad, I fixed it. Thanks! ---------------------------------------------------------------- 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