You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ch...@apache.org on 2026/10/14 20:17:59 UTC
(kafka) branch trunk updated: MINOR: Prevent swallowing exceptions in MetricsDuringTopicCreationDeletionTest (#23704)
This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new e58847b4d46 MINOR: Prevent swallowing exceptions in MetricsDuringTopicCreationDeletionTest (#23704)
e58847b4d46 is described below
commit e58847b4d46869704e87b071eb2b8b96cffe93a3
Author: Yen-Ting Li <yt...@gmail.com>
AuthorDate: Thu Oct 15 04:17:52 2026 +0800
MINOR: Prevent swallowing exceptions in MetricsDuringTopicCreationDeletionTest (#23704)
`createAndDeleteTopics()` wrapped `createTopic()` and `deleteTopic()` in
`catch (Exception ignored)`. The original Scala test tolerated failures
because `deleteTopic` did not wait for deletion to complete.
`ClusterInstance.deleteTopic` now does, so the catch is no longer needed
and only hides `InterruptedException`.
This PR removes the try/catch and lets exceptions propagate.
Reviewers: Chia-Ping Tsai <ch...@gmail.com>
---
.../kafka/clients/MetricsDuringTopicCreationDeletionTest.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/MetricsDuringTopicCreationDeletionTest.java b/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/MetricsDuringTopicCreationDeletionTest.java
index 3dc83d8611d..7588352ad8a 100644
--- a/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/MetricsDuringTopicCreationDeletionTest.java
+++ b/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/MetricsDuringTopicCreationDeletionTest.java
@@ -31,6 +31,7 @@ import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -126,20 +127,16 @@ public class MetricsDuringTopicCreationDeletionTest {
+ ", but got: " + underReplicatedPartitionsCount.get());
}
- private void createAndDeleteTopics() {
+ private void createAndDeleteTopics() throws InterruptedException, ExecutionException {
for (int i = 1; i <= CREATE_DELETE_ITERATIONS && running; i++) {
for (String topic : topics) {
if (!running) return;
- try {
- clusterInstance.createTopic(topic, PARTITION_NUM, REPLICATION_FACTOR);
- } catch (Exception ignored) { }
+ clusterInstance.createTopic(topic, PARTITION_NUM, REPLICATION_FACTOR);
}
for (String topic : topics) {
if (!running) return;
- try {
- clusterInstance.deleteTopic(topic);
- } catch (Exception ignored) { }
+ clusterInstance.deleteTopic(topic);
}
}
}