lucasbru commented on code in PR #14817:
URL: https://github.com/apache/kafka/pull/14817#discussion_r1403333866


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java:
##########
@@ -204,6 +206,24 @@ public void testCommitted() {
         }
     }
 
+    @Test
+    public void testCommittedLeaderEpochUpdate() {
+        final TopicPartition t0 = new TopicPartition("t0", 2);
+        final TopicPartition t1 = new TopicPartition("t0", 3);
+        HashMap<TopicPartition, OffsetAndMetadata> topicPartitionOffsets = new 
HashMap<>();
+        topicPartitionOffsets.put(t0, new OffsetAndMetadata(10L, 
Optional.of(2), ""));
+        topicPartitionOffsets.put(t1, null);
+
+        CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> 
committedFuture = new CompletableFuture<>();
+        committedFuture.complete(topicPartitionOffsets);
+
+        try (MockedConstruction<OffsetFetchApplicationEvent> ignored = 
offsetFetchEventMocker(committedFuture)) {
+            assertDoesNotThrow(() -> 
consumer.committed(topicPartitionOffsets.keySet(), Duration.ofMillis(1000)));
+            verify(testBuilder.metadata).updateLastSeenEpochIfNewer(t0, 2);
+            
verify(applicationEventHandler).add(ArgumentMatchers.isA(OffsetFetchApplicationEvent.class));

Review Comment:
   Done



##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java:
##########
@@ -204,6 +206,24 @@ public void testCommitted() {
         }
     }
 
+    @Test
+    public void testCommittedLeaderEpochUpdate() {
+        final TopicPartition t0 = new TopicPartition("t0", 2);
+        final TopicPartition t1 = new TopicPartition("t0", 3);
+        HashMap<TopicPartition, OffsetAndMetadata> topicPartitionOffsets = new 
HashMap<>();
+        topicPartitionOffsets.put(t0, new OffsetAndMetadata(10L, 
Optional.of(2), ""));
+        topicPartitionOffsets.put(t1, null);
+
+        CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> 
committedFuture = new CompletableFuture<>();
+        committedFuture.complete(topicPartitionOffsets);
+
+        try (MockedConstruction<OffsetFetchApplicationEvent> ignored = 
offsetFetchEventMocker(committedFuture)) {
+            assertDoesNotThrow(() -> 
consumer.committed(topicPartitionOffsets.keySet(), Duration.ofMillis(1000)));
+            verify(testBuilder.metadata).updateLastSeenEpochIfNewer(t0, 2);

Review Comment:
   Done



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