chia7712 commented on code in PR #18889:
URL: https://github.com/apache/kafka/pull/18889#discussion_r1957730744


##########
core/src/test/scala/integration/kafka/api/ConsumerWithLegacyMessageFormatIntegrationTest.scala:
##########
@@ -18,16 +18,43 @@ package kafka.api
 
 import kafka.utils.TestInfoUtils
 import org.apache.kafka.common.TopicPartition
+import org.apache.kafka.common.compress.Compression
+import org.apache.kafka.common.record.{AbstractRecords, CompressionType, 
MemoryRecords, RecordBatch, RecordVersion, SimpleRecord, TimestampType}
 import org.junit.jupiter.api.Assertions.{assertEquals, assertNull, 
assertThrows}
 import org.junit.jupiter.params.ParameterizedTest
 import org.junit.jupiter.params.provider.MethodSource
 
+import java.nio.ByteBuffer
 import java.util
 import java.util.{Collections, Optional}
 import scala.jdk.CollectionConverters._
 
 class ConsumerWithLegacyMessageFormatIntegrationTest extends 
AbstractConsumerTest {
 
+  private def appendLegacyRecords(numRecords: Int, tp: TopicPartition, 
startingTimestamp: Long, brokerId: Int): Unit = {
+    val records = (0 until numRecords).map { i =>
+      new SimpleRecord(startingTimestamp + i, s"key $i".getBytes, s"value 
$i".getBytes)
+    }
+    val buffer = 
ByteBuffer.allocate(AbstractRecords.estimateSizeInBytes(RecordBatch.MAGIC_VALUE_V0,
 CompressionType.NONE, records.asJava))
+    val builder = MemoryRecords.builder(buffer, RecordBatch.MAGIC_VALUE_V0, 
Compression.of(CompressionType.NONE).build,

Review Comment:
   Could you please keep tests for both v0 and v1?



-- 
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]

Reply via email to