hachikuji commented on a change in pull request #10006:
URL: https://github.com/apache/kafka/pull/10006#discussion_r567162723



##########
File path: 
clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java
##########
@@ -1745,51 +1742,77 @@ public void testSeekWithInFlightReset() {
         assertEquals(237L, subscriptions.position(tp0).offset);
     }
 
-    @Timeout(10)
+    private boolean listOffsetMatchesExpectedReset(
+        TopicPartition tp,
+        OffsetResetStrategy strategy,
+        AbstractRequest request
+    ) {
+        if (!(request instanceof ListOffsetsRequest)) {
+            return false;
+        }
+
+        ListOffsetsRequest req = (ListOffsetsRequest) request;
+        if (req.data().topics().size() != 1) {
+            return false;
+        }
+
+        ListOffsetsTopic listTopic = req.data().topics().get(0);
+        if (!listTopic.name().equals(tp.topic())) {
+            return false;
+        }
+
+        if (listTopic.partitions().size() != 1) {
+            return false;
+        }
+
+        ListOffsetsPartition listPartition = listTopic.partitions().get(0);
+        if (listPartition.partitionIndex() != tp.partition()) {
+            return false;
+        }
+
+        long timestamp = listPartition.timestamp();
+        if (strategy == OffsetResetStrategy.EARLIEST && timestamp != 
ListOffsetsRequest.EARLIEST_TIMESTAMP) {
+            return false;
+        }
+
+        if (strategy == OffsetResetStrategy.LATEST && timestamp != 
ListOffsetsRequest.LATEST_TIMESTAMP) {
+            return false;
+        }
+
+        return true;
+    }
+
     @Test
-    public void testEarlierOffsetResetArrivesLate() throws 
InterruptedException {
-        LogContext lc = new LogContext();
-        buildFetcher(spy(new SubscriptionState(lc, 
OffsetResetStrategy.EARLIEST)), lc);
+    public void testEarlierOffsetResetArrivesLate() {
+        buildFetcher();

Review comment:
       Because the test case sets it explicitly below.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to