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

mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/master by this push:
     new 0621056  Add assumption guards for incompatible integration tests
0621056 is described below

commit 0621056763e5a1fd46de1578b2ac6fa211da6fe1
Author: Matt Sicker <[email protected]>
AuthorDate: Sat Jan 8 18:31:28 2022 -0600

    Add assumption guards for incompatible integration tests
    
    Signed-off-by: Matt Sicker <[email protected]>
---
 .../logging/log4j/mongodb3/MongoDb3TestRule.java   | 25 ++++++++++++++--------
 .../logging/log4j/mongodb4/MongoDb4TestRule.java   | 19 ++++++++++------
 2 files changed, 29 insertions(+), 15 deletions(-)

diff --git 
a/log4j-mongodb3/src/test/java/org/apache/logging/log4j/mongodb3/MongoDb3TestRule.java
 
b/log4j-mongodb3/src/test/java/org/apache/logging/log4j/mongodb3/MongoDb3TestRule.java
index 59a05ff..3b7e5ed 100644
--- 
a/log4j-mongodb3/src/test/java/org/apache/logging/log4j/mongodb3/MongoDb3TestRule.java
+++ 
b/log4j-mongodb3/src/test/java/org/apache/logging/log4j/mongodb3/MongoDb3TestRule.java
@@ -20,6 +20,7 @@ package org.apache.logging.log4j.mongodb3;
 import java.util.Objects;
 
 import org.apache.commons.lang3.NotImplementedException;
+import org.junit.AssumptionViolatedException;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
@@ -127,15 +128,21 @@ public class MongoDb3TestRule implements TestRule {
                 final String value = 
Objects.requireNonNull(System.getProperty(portSystemPropertyName),
                         "System property '" + portSystemPropertyName + "' is 
null");
                 final int port = Integer.parseInt(value);
-                mongodExecutable = starter.prepare(
-                // @formatter:off
-                        new MongodConfigBuilder()
-                            .version(Version.Main.PRODUCTION)
-                            .timeout(new Timeout(BUILDER_TIMEOUT_MILLIS))
-                            .net(
-                                    new Net("localhost", port, 
Network.localhostIsIPv6()))
-                            .build());
-                // @formatter:on
+                try {
+                    mongodExecutable = starter.prepare(
+                    // @formatter:off
+                            new MongodConfigBuilder()
+                                    .version(Version.Main.PRODUCTION)
+                                    .timeout(new 
Timeout(BUILDER_TIMEOUT_MILLIS))
+                                    .net(
+                                            new Net("localhost", port, 
Network.localhostIsIPv6()))
+                                    .build());
+                    // @formatter:on
+                } catch (final IllegalArgumentException e) {
+                    if (e.getMessage().contains("this version does not support 
32Bit")) {
+                        throw new AssumptionViolatedException("Unsupported 
platform: " + e.getMessage());
+                    }
+                }
                 mongodProcess = mongodExecutable.start();
                 mongoClient = new MongoClient("localhost", port);
                 try {
diff --git 
a/log4j-mongodb4/src/test/java/org/apache/logging/log4j/mongodb4/MongoDb4TestRule.java
 
b/log4j-mongodb4/src/test/java/org/apache/logging/log4j/mongodb4/MongoDb4TestRule.java
index 4d9d5d5..0b6e860 100644
--- 
a/log4j-mongodb4/src/test/java/org/apache/logging/log4j/mongodb4/MongoDb4TestRule.java
+++ 
b/log4j-mongodb4/src/test/java/org/apache/logging/log4j/mongodb4/MongoDb4TestRule.java
@@ -20,6 +20,7 @@ package org.apache.logging.log4j.mongodb4;
 import java.util.Objects;
 
 import org.apache.commons.lang3.NotImplementedException;
+import org.junit.AssumptionViolatedException;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
@@ -124,12 +125,18 @@ public class MongoDb4TestRule implements TestRule {
                 final String value = 
Objects.requireNonNull(System.getProperty(portSystemPropertyName),
                         "System property '" + portSystemPropertyName + "' is 
null");
                 final int port = Integer.parseInt(value);
-                mongodExecutable = starter.prepare(
-                // @formatter:off
-                        new 
MongodConfigBuilder().version(Version.Main.PRODUCTION)
-                                .timeout(new Timeout(BUILDER_TIMEOUT_MILLIS))
-                                .net(new Net("localhost", port, 
Network.localhostIsIPv6())).build());
-                // @formatter:on
+                try {
+                    mongodExecutable = starter.prepare(
+                    // @formatter:off
+                            new 
MongodConfigBuilder().version(Version.Main.PRODUCTION)
+                                    .timeout(new 
Timeout(BUILDER_TIMEOUT_MILLIS))
+                                    .net(new Net("localhost", port, 
Network.localhostIsIPv6())).build());
+                    // @formatter:on
+                } catch (final IllegalArgumentException e) {
+                    if (e.getMessage().contains("this version does not support 
32Bit")) {
+                        throw new AssumptionViolatedException("Unsupported 
platform: " + e.getMessage());
+                    }
+                }
                 mongodProcess = mongodExecutable.start();
                 mongoClient = MongoClients.create("mongodb://localhost:" + 
port);
                 try {

Reply via email to