From 6c84e5c59bd63549080aed72398caa286ee519ac Mon Sep 17 00:00:00 2001 From: Julian Reschke Date: Sun, 1 Sep 2024 09:29:02 +0200 Subject: [PATCH] OAK-11062: document-store: refine skipping of MongoDB tests (MongoConnectionFactory) (#1677) --- .../oak/plugins/document/MongoConnectionFactory.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java index ce07750d652..5c0de58f11a 100644 --- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java +++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MongoConnectionFactory.java @@ -19,14 +19,17 @@ import java.util.List; import org.apache.jackrabbit.guava.common.collect.Lists; - +import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier; import org.apache.jackrabbit.oak.plugins.document.mongo.MongoDockerRule; import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection; import org.jetbrains.annotations.Nullable; import org.junit.rules.ExternalResource; import org.junit.runner.Description; import org.junit.runners.model.Statement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeNotNull; public class MongoConnectionFactory extends ExternalResource { @@ -35,6 +38,10 @@ public class MongoConnectionFactory extends ExternalResource { private final List connections = Lists.newArrayList(); + private static final Logger LOG = LoggerFactory.getLogger(MongoConnectionFactory.class); + + private static final boolean SKIP_MONGO = SystemPropertySupplier.create("oak.skipMongo", false).loggingTo(LOG).get(); + @Override public Statement apply(Statement base, Description description) { Statement s = super.apply(base, description); @@ -51,6 +58,8 @@ public MongoConnection getConnection() { @Nullable public MongoConnection getConnection(String dbName) { + // skip test when told so (OAK-11062) + assumeFalse(SKIP_MONGO); // first try MongoDB running on configured host and port MongoConnection c = MongoUtils.getConnection(dbName); if (c == null && MongoDockerRule.isDockerAvailable()) {