ahuang98 commented on code in PR #18852:
URL: https://github.com/apache/kafka/pull/18852#discussion_r1956751434
##########
core/src/test/scala/kafka/raft/KafkaMetadataLogTest.scala:
##########
@@ -108,12 +116,57 @@ final class KafkaMetadataLogTest {
classOf[RuntimeException],
() => {
log.appendAsFollower(
- MemoryRecords.withRecords(initialOffset, Compression.NONE,
currentEpoch, recordFoo)
+ MemoryRecords.withRecords(initialOffset, Compression.NONE,
currentEpoch, recordFoo),
+ currentEpoch
)
}
)
}
+ @Test
+ def testEmptyAppendNotAllowed(): Unit = {
+ val log = buildMetadataLog(tempDir, mockTime)
+
+ assertThrows(classOf[IllegalArgumentException], () =>
log.appendAsFollower(MemoryRecords.EMPTY, 1));
+ assertThrows(classOf[IllegalArgumentException], () =>
log.appendAsLeader(MemoryRecords.EMPTY, 1));
+ }
+
+ @ParameterizedTest
+ @ArgumentsSource(classOf[InvalidMemoryRecordsProvider])
Review Comment:
maybe I'm missing something - should we also have a test here where we call
`log.appendAsFollower(records, epoch)` where `epoch` is less than one of the
epochs in the records batch? it could be a malformed batch and we could check
that the test does not throw CorruptRecordException
--
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]