From 0b5c50f62ca1d37983d5a396230553eb4992a65a Mon Sep 17 00:00:00 2001 From: Jhen-Yung Hsu Date: Wed, 2 Jul 2025 23:53:34 +0800 Subject: [PATCH] MINOR: Fix the tests in LogValidatorTest --- .../kafka/storage/internals/log/LogValidatorTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/src/test/java/org/apache/kafka/storage/internals/log/LogValidatorTest.java b/storage/src/test/java/org/apache/kafka/storage/internals/log/LogValidatorTest.java index c06965930910c..ac062dde346d5 100644 --- a/storage/src/test/java/org/apache/kafka/storage/internals/log/LogValidatorTest.java +++ b/storage/src/test/java/org/apache/kafka/storage/internals/log/LogValidatorTest.java @@ -361,7 +361,7 @@ public void checkRecompression(byte magic) { assertTrue(batch.isValid()); assertEquals(TimestampType.CREATE_TIME, batch.timestampType()); maybeCheckBaseTimestamp(timestampSeq.get(0), batch); - assertEquals(batch.maxTimestamp(), batch.maxTimestamp()); + assertEquals(batch.maxTimestamp(), TestUtils.toList(batch).stream().map(Record::timestamp).max(Long::compare).get()); assertEquals(producerEpoch, batch.producerEpoch()); assertEquals(producerId, batch.producerId()); assertEquals(baseSequence, batch.baseSequence()); @@ -552,7 +552,7 @@ public void checkCompressed(byte magic) { assertTrue(batch.isValid()); assertEquals(batch.timestampType(), TimestampType.CREATE_TIME); maybeCheckBaseTimestamp(timestampSeq.get(0), batch); - assertEquals(batch.maxTimestamp(), batch.maxTimestamp()); + assertEquals(batch.maxTimestamp(), TestUtils.toList(batch).stream().map(Record::timestamp).max(Long::compare).get()); assertEquals(producerEpoch, batch.producerEpoch()); assertEquals(producerId, batch.producerId()); assertEquals(baseSequence, batch.baseSequence()); @@ -1805,7 +1805,7 @@ public void checkNonCompressed(byte magic) { assertTrue(batch.isValid()); assertEquals(TimestampType.CREATE_TIME, batch.timestampType()); maybeCheckBaseTimestamp(timestampSeq[0], batch); - assertEquals(batch.maxTimestamp(), batch.maxTimestamp()); + assertEquals(batch.maxTimestamp(), TestUtils.toList(batch).stream().map(Record::timestamp).max(Long::compare).get()); assertEquals(producerEpoch, batch.producerEpoch()); assertEquals(producerId, batch.producerId());