TaiJuWu commented on code in PR #16627:
URL: https://github.com/apache/kafka/pull/16627#discussion_r1689009256


##########
core/src/test/java/kafka/test/ClusterInstance.java:
##########
@@ -183,6 +193,67 @@ default Set<GroupProtocol> supportedGroupProtocols() {
 
     //---------------------------[wait]---------------------------//
 
+    @SuppressWarnings("deprecation")
+    default void verifyTopicDeletion(String topic, int partitions) throws 
InterruptedException {
+        if (!isKRaftTest()) {
+            TestUtils.waitForCondition(
+                    () -> !((IntegrationTestHarness) 
getUnderlying()).zkClient().isTopicMarkedForDeletion(topic),
+                    String.format("Admin path /admin/delete_topics/%s path not 
deleted even after a replica is restarted", topic)
+            );
+
+            TestUtils.waitForCondition(
+                    () -> !((IntegrationTestHarness) 
getUnderlying()).zkClient().topicExists(topic),
+                    String.format("Topic path /brokers/topics/%s not deleted 
after /admin/delete_topics/%s path is deleted", topic, topic)
+            );
+        }
+
+        List<TopicPartition> topicPartitions = IntStream.range(0, 
partitions).mapToObj(i -> new TopicPartition(topic, 
i)).collect(Collectors.toList());
+        TestUtils.waitForCondition(
+                () ->
+                        brokers().values().stream().allMatch(broker ->
+                                topicPartitions.stream().allMatch(tp ->
+                                        
broker.replicaManager().onlinePartition(tp).isEmpty())
+                        ), "Replica manager's should have deleted all of this 
topic's partitions"
+        );
+
+        TestUtils.waitForCondition(
+                () ->
+                        brokers().values().stream().allMatch(broker ->
+                                topicPartitions.stream().allMatch(tp ->
+                                        
broker.replicaManager().onlinePartition(tp).isEmpty())
+                        ), "Replica logs not deleted after delete topic is 
complete"
+        );
+
+
+        TestUtils.waitForCondition(() -> 
brokers().values().stream().allMatch(broker ->
+                topicPartitions.stream().allMatch(tp ->
+                        
JavaConverters.seqAsJavaList(broker.logManager().liveLogDirs()).stream()
+                                .map(logDir -> JavaConverters.mapAsJavaMap(new 
OffsetCheckpointFile(new File(logDir, "cleaner-offset-checkpoint"), 
null).read()))
+                                .collect(Collectors.toList())

Review Comment:
   Remove it.



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