This is an automated email from the ASF dual-hosted git repository.

cdeppisch pushed a commit to branch 4.14.x
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 7f978933381e84af3ac217234637b15ab75be2b3
Author: Christoph Deppisch <christoph.deppi...@web.de>
AuthorDate: Tue Sep 9 09:06:07 2025 +0200

    Improve integration tests
    
    - Stop Kafka producer after test
    - Avoid endless Kafka connection warning logs
    
    (cherry picked from commit 145343c851b1b289e3b63c8affa6fe9c02d1a081)
---
 tests/camel-kamelets-itest/src/test/java/KafkaIT.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/camel-kamelets-itest/src/test/java/KafkaIT.java 
b/tests/camel-kamelets-itest/src/test/java/KafkaIT.java
index dbe3677f5..2c619dbde 100644
--- a/tests/camel-kamelets-itest/src/test/java/KafkaIT.java
+++ b/tests/camel-kamelets-itest/src/test/java/KafkaIT.java
@@ -27,6 +27,7 @@ import org.citrusframework.http.server.HttpServer;
 import org.citrusframework.junit.jupiter.CitrusSupport;
 import org.citrusframework.junit.jupiter.CitrusTestFactory;
 import org.citrusframework.junit.jupiter.CitrusTestFactorySupport;
+import org.citrusframework.kafka.endpoint.KafkaEndpoint;
 import org.citrusframework.spi.BindToRegistry;
 import org.citrusframework.util.SocketUtils;
 import org.junit.jupiter.api.DynamicTest;
@@ -86,6 +87,15 @@ public class KafkaIT {
             } catch (Exception e) {
                 // ignore
             }
+
+            try {
+                Endpoint endpoint = 
context.getEndpointFactory().create("kafkaProducer", context);
+                if (endpoint instanceof KafkaEndpoint kafkaEndpoint) {
+                    kafkaEndpoint.createProducer().getProducer().close();
+                }
+            } catch (Exception e) {
+                // ignore
+            }
         };
     }
 

Reply via email to