jeffkbkim commented on code in PR #14985: URL: https://github.com/apache/kafka/pull/14985#discussion_r1433029392
########## core/src/test/scala/unit/kafka/coordinator/group/CoordinatorLoaderImplTest.scala: ########## @@ -511,4 +544,35 @@ class CoordinatorLoaderImplTest { new FetchDataInfo(new LogOffsetMetadata(startOffset), fileRecords) } + + private def logReadResult( + startOffset: Long, + producerId: Long, + producerEpoch: Short, + controlRecordType: ControlRecordType + ): FetchDataInfo = { + val fileRecords = mock(classOf[FileRecords]) + val memoryRecords = MemoryRecords.withEndTransactionMarker( + startOffset, + 0L, + RecordBatch.NO_PARTITION_LEADER_EPOCH, + producerId, + producerEpoch, + new EndTransactionMarker(controlRecordType, 0) + ) + + when(fileRecords.sizeInBytes).thenReturn(memoryRecords.sizeInBytes) + + val bufferCapture: ArgumentCaptor[ByteBuffer] = ArgumentCaptor.forClass(classOf[ByteBuffer]) + when(fileRecords.readInto( + bufferCapture.capture(), + ArgumentMatchers.anyInt()) + ).thenAnswer { _ => + val buffer = bufferCapture.getValue + buffer.put(memoryRecords.buffer.duplicate) + buffer.flip() + } + + new FetchDataInfo(new LogOffsetMetadata(startOffset), fileRecords) Review Comment: aren't we reading from the log in https://github.com/apache/kafka/pull/14985/files#diff-64992589f1b20d6db189de7b1e613d222be46fb2999cdc9790f8c27c380f3092R114-R115 as well? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org