This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new e14b2c2b2ba3 CAMEL-24290: stabilize the MasterEndpointIT, MongoDB and
Cassandra ITs (#29356)
e14b2c2b2ba3 is described below
commit e14b2c2b2ba3e9ac7fb1167b8e874cdf2d0ea286
Author: Adriano Machado <[email protected]>
AuthorDate: Fri Nov 6 16:01:09 2026 -0500
CAMEL-24290: stabilize the MasterEndpointIT, MongoDB and Cassandra ITs
(#29356)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
.../component/cassandra/integration/BaseCassandra.java | 2 +-
.../mongodb/integration/AbstractMongoDbITSupport.java | 15 +++++++++++++++
.../mongodb/integration/MongoDbFindOperationIT.java | 11 +++++++++++
.../camel/component/zookeepermaster/MasterEndpointIT.java | 3 ++-
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git
a/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
b/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
index 9ea8bdb61cba..f5721e311b44 100644
---
a/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
+++
b/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
@@ -96,7 +96,7 @@ public abstract class BaseCassandra implements
ConfigurableRoute, CamelTestSuppo
.withLocalDatacenter(DATACENTER_NAME)
.withKeyspace(KEYSPACE_NAME)
.withConfigLoader(DriverConfigLoader.programmaticBuilder()
- .withDuration(DefaultDriverOption.REQUEST_TIMEOUT,
Duration.ofSeconds(10)).build())
+ .withDuration(DefaultDriverOption.REQUEST_TIMEOUT,
Duration.ofSeconds(30)).build())
.addContactPoint(endpoint).build();
}
return session;
diff --git
a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
index 413cb9b0664b..ab9d6ccde6bd 100644
---
a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
+++
b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/AbstractMongoDbITSupport.java
@@ -39,6 +39,7 @@ import
org.apache.camel.test.infra.mongodb.services.MongoDBServiceFactory;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.bson.Document;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
@@ -104,6 +105,20 @@ public abstract class AbstractMongoDbITSupport implements
ConfigurableContext {
dynamicCollection = db.getCollection(dynamicCollectionName,
Document.class);
}
+ @AfterAll
+ static void closeMongoClient() {
+ // stop the context first: it uses the client (bound as myDb) and
consumers may still be reading from it
+ CamelContext camelContext = contextExtension.getContext();
+ if (camelContext != null) {
+ camelContext.stop();
+ }
+ // the container is a JVM-wide singleton: close the client created per
test class, or they pile up
+ if (mongo != null) {
+ mongo.close();
+ mongo = null;
+ }
+ }
+
@AfterEach
public void tearDown() {
if (testCollection != null) {
diff --git
a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java
b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java
index b4c413696aff..4ee393111a53 100644
---
a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java
+++
b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbFindOperationIT.java
@@ -40,6 +40,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
+import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -70,10 +71,20 @@ public class MongoDbFindOperationIT extends
CamelTestSupport {
public void doPreSetup() throws Exception {
super.doPreSetup();
+ closeMongoClient();
mongo = MongoClients.create(service.getReplicaSetUrl());
db = mongo.getDatabase(dbName);
}
+ @AfterAll
+ static void closeMongoClient() {
+ // the container is a JVM-wide singleton: close the client, or they
pile up
+ if (mongo != null) {
+ mongo.close();
+ mongo = null;
+ }
+ }
+
@Override
protected void doPostSetup() {
// Refresh the test collection - drop it and recreate it. We don't do
diff --git
a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
index 359b6cc66593..3e83f18f426f 100644
---
a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
+++
b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.zookeepermaster;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
@@ -65,7 +66,7 @@ public class MasterEndpointIT {
resultEndpoint.expectedBodiesReceived(expectedBody);
MasterConsumer masterConsumer = (MasterConsumer)
camelContext.getRoute("zookeeper-master-to-direct").getConsumer();
- Awaitility.await().until(() -> masterConsumer.isMaster() &&
masterConsumer.isConnected());
+ Awaitility.await().atMost(30, TimeUnit.SECONDS).until(() ->
masterConsumer.isMaster() && masterConsumer.isConnected());
template.sendBodyAndHeader(expectedBody, "foo", "bar");