Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions core/src/test/scala/unit/kafka/log/LogValidatorTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,15 @@ class LogValidatorTest {
(RecordBatch.NO_PRODUCER_ID, RecordBatch.NO_PRODUCER_EPOCH, RecordBatch.NO_SEQUENCE, false,
RecordBatch.NO_PARTITION_LEADER_EPOCH)

val records = MemoryRecords.withRecords(magic, 0L, CompressionType.GZIP, TimestampType.CREATE_TIME, producerId,
val records = MemoryRecords.withRecords(magic, 0L, CompressionType.NONE, TimestampType.CREATE_TIME, producerId,
producerEpoch, baseSequence, partitionLeaderEpoch, isTransactional,
new SimpleRecord(timestampSeq(0), "hello".getBytes),
new SimpleRecord(timestampSeq(1), "there".getBytes),
new SimpleRecord(timestampSeq(2), "beautiful".getBytes))

// V2 has single batch, and other versions has many single-record batches
assertEquals(if (magic >= RecordBatch.MAGIC_VALUE_V2) 1 else 3, records.batches().asScala.size)

val validatingResults = new LogValidator(records,
topicPartition,
time,
Expand Down Expand Up @@ -497,9 +500,9 @@ class LogValidatorTest {
assertEquals(now + 1, validatingResults.maxTimestampMs,
s"Max timestamp should be ${now + 1}")

// Both V2 and V1 has single branch in the record when compression is enable, and hence their shallow OffsetOfMaxTimestamp
// is the last offset of the single branch
assertEquals(1, records.batches().asScala.size)
// Both V2 and V1 has single batch in the validated records when compression is enable, and hence their shallow
// OffsetOfMaxTimestamp is the last offset of the single batch
assertEquals(1, validatedRecords.batches().asScala.size)
assertEquals(2, validatingResults.shallowOffsetOfMaxTimestamp)
assertTrue(validatingResults.messageSizeMaybeChanged,
"Message size should have been changed")
Expand Down