chia7712 commented on PR #22529:
URL: https://github.com/apache/kafka/pull/22529#issuecomment-4976206242

   @lucasbru thanks for this patch. This approach is LGTM. Would you mind 
adding a small integration test? For example:
   ```java
       public void 
testAdminClientCloseGracePeriodWithStaleLeader(ClusterInstance cluster) throws 
Exception {
           try (Admin admin = cluster.admin()) {
               String topic = "test-topic";
               admin.createTopics(List.of(new NewTopic(topic, 1, (short) 
1))).all().get();
   
               TopicDescription topicDescription = 
admin.describeTopics(List.of(topic))
                       .allTopicNames().get().get(topic);
               int leaderId = 
topicDescription.partitions().get(0).leader().id();
   
               var tp = new TopicPartition(topic, 0);
               // update cache
               admin.deleteRecords(Map.of(tp, 
RecordsToDelete.beforeOffset(0L))).all().get();
               
               // cache miss
               cluster.shutdownBroker(leaderId);
   
               DeleteRecordsResult result = admin.deleteRecords(Map.of(tp, 
RecordsToDelete.beforeOffset(0L)));
   
               admin.close(Duration.ofSeconds(5));
               
               var e = Assertions.assertThrows(ExecutionException.class, () -> 
result.all().get());
               Assertions.assertInstanceOf(TimeoutException.class, 
e.getCause());
           }
       }
   ```


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