From 2bdfec6f226fde590547245b161336ae226f61ad Mon Sep 17 00:00:00 2001 From: see-quick Date: Mon, 13 Jan 2025 14:31:59 +0100 Subject: [PATCH] better clean-up Signed-off-by: see-quick --- .../bridge/http/base/HttpBridgeITAbstract.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/strimzi/kafka/bridge/http/base/HttpBridgeITAbstract.java b/src/test/java/io/strimzi/kafka/bridge/http/base/HttpBridgeITAbstract.java index 052b5cbf..3f5416e1 100644 --- a/src/test/java/io/strimzi/kafka/bridge/http/base/HttpBridgeITAbstract.java +++ b/src/test/java/io/strimzi/kafka/bridge/http/base/HttpBridgeITAbstract.java @@ -164,7 +164,23 @@ void setUpEach() { void cleanUp() throws InterruptedException, ExecutionException { Collection topics = adminClientFacade.listTopic(); LOGGER.info("Kafka still contains {}", topics); - adminClientFacade.deleteTopics(topics); + + if (!topics.isEmpty()) { + try { + adminClientFacade.deleteTopics(topics); + } catch (ExecutionException executionException) { + if (executionException.getCause() instanceof org.apache.kafka.common.errors.UnknownTopicOrPartitionException) { + LOGGER.warn("Some topics not found (already deleted). Ignoring ..."); + } else { + throw executionException; + } + } + + Collection remainingTopics = adminClientFacade.listTopic(); + if (!remainingTopics.isEmpty()) { + LOGGER.error("Topics still present after cleanup: {}", remainingTopics); + } + } } protected String generateRandomConsumerGroupName() {