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

reschke pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6c84e5c59b OAK-11062: document-store: refine skipping of MongoDB tests 
(MongoConnectionFactory) (#1677)
6c84e5c59b is described below

commit 6c84e5c59bd63549080aed72398caa286ee519ac
Author: Julian Reschke <[email protected]>
AuthorDate: Sun Sep 1 09:29:02 2024 +0200

    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 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()) {

Reply via email to