From 11e191079c94f7f4f73a79c28e169efae99f66a5 Mon Sep 17 00:00:00 2001 From: Yen-Ting Li Date: Mon, 5 Oct 2026 13:10:00 +0800 Subject: [PATCH] MINOR: Stop swallowing exceptions in MetricsDuringTopicCreationDeletionTest createAndDeleteTopics() wrapped createTopic/deleteTopic in catch (Exception ignored). If topic creation or deletion failed, the metrics never changed and the test could pass without exercising anything. Let the exceptions propagate so such failures fail the test. --- .../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 3dc83d8611db1..7588352ad8a28 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.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 void testMetricsDuringTopicCreateDelete() throws Exception { + ", 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); } } }