chirag-wadhwa5 commented on code in PR #21265:
URL: https://github.com/apache/kafka/pull/21265#discussion_r2669367308


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/ShareConsumerTest.java:
##########
@@ -2926,6 +2927,37 @@ public void 
testExplicitAcknowledgeReleaseAcceptInRecordLimitMode() {
         }
     }
 
+    @ClusterTest
+    public void testCommitSyncFailsForDeletedTopic() throws 
InterruptedException {
+        Uuid topicId = createTopic("baz", 1, 1);
+        alterShareAutoOffsetReset("group1", "earliest");
+        try (Producer<byte[], byte[]> producer = createProducer();
+             ShareConsumer<byte[], byte[]> shareConsumer = createShareConsumer(
+                 "group1",
+                 Map.of(ConsumerConfig.SHARE_ACKNOWLEDGEMENT_MODE_CONFIG, 
EXPLICIT))
+        ) {
+            for (int i = 0; i < 10; i++) {
+                ProducerRecord<byte[], byte[]> record = new 
ProducerRecord<>("baz", 0, null, "key".getBytes(), ("Message " + i).getBytes());
+                producer.send(record);
+            }
+            producer.flush();
+
+            shareConsumer.subscribe(List.of("baz"));
+            ConsumerRecords<byte[], byte[]> records = 
waitedPoll(shareConsumer, 2500L, 10);
+            assertEquals(10, records.count());
+
+            records.forEach(shareConsumer::acknowledge);
+
+            // Topic deletion does not necessarily become apparent across the 
cluster immediately, so sleep a short while
+            deleteTopic("baz");
+            Thread.sleep(5000);

Review Comment:
   Thanks for the PR
   Nit: Can we use waitUntilTrue here instead of a sleep ? Maybe listing the 
topics and verifying that the topic in consideration is not part of the list 
can be the condition ?



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