junrao commented on code in PR #14385:
URL: https://github.com/apache/kafka/pull/14385#discussion_r1329179154


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumerTest.java:
##########
@@ -361,6 +364,84 @@ public void testWakeup_committed() {
         assertNoPendingWakeup(consumer.wakeupTrigger());
     }
 
+    @Test
+    public void testRefreshCommittedOffsetsSuccess() {
+        Map<TopicPartition, OffsetAndMetadata> committedOffsets =
+                Collections.singletonMap(new TopicPartition("t1", 1), new 
OffsetAndMetadata(10L));
+        testRefreshCommittedOffsetsSuccess(committedOffsets);
+    }
+
+    @Test
+    public void testRefreshCommittedOffsetsSuccessButNoCommittedOffsetsFound() 
{
+        testRefreshCommittedOffsetsSuccess(Collections.emptyMap());
+    }
+
+    @Test
+    public void testRefreshCommittedOffsetsShouldNotResetIfFailedWithTimeout() 
{
+        // Create consumer with group id to enable committed offset usage
+        this.groupId = "consumer-group-1";
+
+        testUpdateFetchPositionsWithFetchCommittedOffsetsTimeout(true);
+    }
+
+    @Test
+    public void testRefreshCommittedOffsetsNotCalledIfNoGroupId() {
+        // Create consumer without group id so committed offsets are not used 
for updating positions
+        this.groupId = null;
+        consumer = newConsumer(time, new StringDeserializer(), new 
StringDeserializer());
+
+        testUpdateFetchPositionsWithFetchCommittedOffsetsTimeout(false);
+    }
+
+    private void 
testUpdateFetchPositionsWithFetchCommittedOffsetsTimeout(boolean 
committedOffsetsEnabled) {

Review Comment:
   Lianet, thanks for the explanation. Make sense to me.



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

Reply via email to