You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2024/09/01 07:28:26 UTC
(jackrabbit-oak) 01/01: OAK-11062: document-store: refine skipping of MongoDB tests (MongoConnectionFactory)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-11062b
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 9e178d7ebea01e3dfea51beba2d60d5a5b90629f
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Sun Sep 1 08:28:04 2024 +0100
OAK-11062: document-store: refine skipping of MongoDB tests (MongoConnectionFactory)
---
.../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 ce07750d65..5c0de58f11 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 @@ package org.apache.jackrabbit.oak.plugins.document;
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<MongoConnection> 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 class MongoConnectionFactory extends ExternalResource {
@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()) {