showuon commented on code in PR #16475:
URL: https://github.com/apache/kafka/pull/16475#discussion_r1666548285
##########
core/src/test/scala/unit/kafka/tools/DumpLogSegmentsTest.scala:
##########
@@ -246,12 +246,17 @@ class DumpLogSegmentsTest {
assertEquals(Map.empty, errors.shallowOffsetNotFound)
}
+ def countSubstring(str: String, sub: String): Int =
+ str.sliding(sub.length).count(_ == sub)
+
@Test
def testDumpRemoteLogMetadataEmpty(): Unit = {
val logConfig = LogTestUtils.createLogConfig(segmentBytes = 1024 * 1024)
log = LogTestUtils.createLog(logDir, logConfig, new BrokerTopicStats,
time.scheduler, time)
val output = runDumpLogSegments(Array("--remote-log-metadata-decoder",
"--files", logFilePath))
+ assertTrue(countSubstring(output, "baseOffset:") == 0)
+ assertTrue(countSubstring(output, "payload:") == 0)
Review Comment:
nit: I don't think the new reader would understand what we are testing here.
I think we can:
1. Add 2 methods: `batchCount`, `recordCount`
2. Add javadoc to these 2 methods to explain why checking `baseOffset` /
`payload` can know the count of batch/record.
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]