brandboat commented on code in PR #20765:
URL: https://github.com/apache/kafka/pull/20765#discussion_r2465885466


##########
core/src/test/java/kafka/server/share/DelayedShareFetchTest.java:
##########
@@ -212,32 +210,30 @@ public void 
testTryCompleteWhenMinBytesNotSatisfiedOnFirstFetch() {
 
         when(sp0.canAcquireRecords()).thenReturn(true);
         when(sp1.canAcquireRecords()).thenReturn(false);
-        when(sp0.acquire(any(), anyInt(), anyInt(), anyLong(), any(), 
any())).thenReturn(
-            createShareAcquiredRecords(new 
ShareFetchResponseData.AcquiredRecords().setFirstOffset(0).setLastOffset(3).setDeliveryCount((short)
 1)));
 
         // We are testing the case when the share partition is getting fetched 
for the first time, so for the first time
-        // the fetchOffsetMetadata will return empty. Post the readFromLog 
call, the fetchOffsetMetadata will be
+        // the fetchOffsetMetadata will return empty. Post the 
isMinBytesSatisfied call, the fetchOffsetMetadata will be
         // populated for the share partition, which has 1 as the positional 
difference, so it doesn't satisfy the minBytes(2).
         when(sp0.fetchOffsetMetadata(anyLong()))
             .thenReturn(Optional.empty())
             .thenReturn(Optional.of(new LogOffsetMetadata(0, 1, 0)));
         LogOffsetMetadata hwmOffsetMetadata = new LogOffsetMetadata(1, 1, 1);
-        mockTopicIdPartitionFetchBytes(replicaManager, tp0, hwmOffsetMetadata);
-
-        doAnswer(invocation -> 
buildLogReadResult(List.of(tp0))).when(replicaManager).readFromLog(any(), 
any(), any(ReplicaQuota.class), anyBoolean());
-        BiConsumer<SharePartitionKey, Throwable> exceptionHandler = 
mockExceptionHandler();
-
-        PartitionMaxBytesStrategy partitionMaxBytesStrategy = 
mockPartitionMaxBytes(Set.of(tp0));

Review Comment:
   yes, I moved the code snippet from mockTopicIdPartitionFetchBytes to here 
and did some refactoring.



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