Yunyung commented on code in PR #20108:
URL: https://github.com/apache/kafka/pull/20108#discussion_r2188485247


##########
test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/ClusterInstance.java:
##########
@@ -288,6 +331,14 @@ default void deleteTopic(String topicName) throws 
InterruptedException {
     void waitForReadyBrokers() throws InterruptedException;
 
     default void waitForTopic(String topic, int partitions) throws 
InterruptedException {
+        if (partitions < 0) {
+            throw new IllegalArgumentException("Partition count must be >= 0, 
but was " + partitions);
+        }
+
+        else if(partitions == 0){
+            waitTopicDeletion(topic);
+        }
+
         // wait for metadata
         Collection<KafkaBroker> brokers = aliveBrokers().values();
         TestUtils.waitForCondition(

Review Comment:
   line 294: `() -> brokers.stream().allMatch(broker -> partitions == 0 ?`
   Here, `partitions == 0` is used to check whether it is waiting for deletion. 
The similar "wait for metadata" logic should also be applied to 
waitTopicDeletion. Please update the code both methods accordingly.



##########
test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/ClusterInstance.java:
##########
@@ -288,6 +331,14 @@ default void deleteTopic(String topicName) throws 
InterruptedException {
     void waitForReadyBrokers() throws InterruptedException;
 
     default void waitForTopic(String topic, int partitions) throws 
InterruptedException {
+        if (partitions < 0) {
+            throw new IllegalArgumentException("Partition count must be >= 0, 
but was " + partitions);
+        }
+
+        else if(partitions == 0){
+            waitTopicDeletion(topic);
+        }
+
         // wait for metadata
         Collection<KafkaBroker> brokers = aliveBrokers().values();
         TestUtils.waitForCondition(

Review Comment:
   line 294: `() -> brokers.stream().allMatch(broker -> partitions == 0 ?`
   Here, `partitions == 0` is used to check whether it is waiting for deletion. 
The similar "wait for metadata" logic should also be applied to 
waitTopicDeletion. Please update the code in both methods accordingly.



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