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

spmallette pushed a commit to branch ci-fix
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 3440c427e8b9785877493fac1213992b0030f2b9
Author: Stephen Mallette <[email protected]>
AuthorDate: Tue Dec 28 18:30:17 2021 -0500

    Prevented neo4j configuration if neo4j not enabled in build
    
    Trying to get to the bottom of why CI builds are failing on 3.4-dev on 
gremlin-server. Success seemed to occur when removing neo4j from gremlin-server 
integration tests runs but showed a number of log error messages where neo4j 
was being configured even though it wasn't on the path. This fix should help at 
least stop the flood of failure errors in the logs which should make them more 
readable. It does not however seem to solve the overall problem for 
gremlin-server builds with neo4j e [...]
---
 .github/workflows/build-test.yml                       |  2 +-
 .../server/AbstractGremlinServerIntegrationTest.java   | 18 ++++++++++++++----
 .../gremlin/server/GremlinDriverIntegrateTest.java     |  6 ++----
 .../gremlin/server/GremlinServerHttpIntegrateTest.java |  6 ++----
 .../server/GremlinServerSessionIntegrateTest.java      | 15 ++++-----------
 5 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index ec0b2e3..c561074 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -43,7 +43,7 @@ jobs:
       - name: Build with Maven
         run: |
           mvn clean install -pl 
-:gremlin-javascript,-:gremlin-python,-gremlin-dotnet,-:gremlin-dotnet-source,-:gremlin-dotnet-tests
 -q -DskipTests -Dci
-          mvn verify -pl :gremlin-server -DskipTests 
-DskipIntegrationTests=false -DincludeNeo4j
+          mvn verify -pl :gremlin-server -DskipTests 
-DskipIntegrationTests=false
   spark-core:
     name: spark core
     timeout-minutes: 45
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
index 634063e..e49c85a 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/AbstractGremlinServerIntegrationTest.java
@@ -155,14 +155,24 @@ public abstract class 
AbstractGremlinServerIntegrationTest {
         return (directory.delete());
     }
 
-    protected static void assumeNeo4jIsPresent() {
-        boolean neo4jIncludedForTesting;
+    protected static void tryIncludeNeo4jGraph(final Settings settings) {
+        if (isNeo4jPresent()) {
+            deleteDirectory(new File("/tmp/neo4j"));
+            settings.graphs.put("graph", "conf/neo4j-empty.properties");
+        }
+    }
+
+    protected static boolean isNeo4jPresent() {
         try {
             Class.forName("org.neo4j.tinkerpop.api.impl.Neo4jGraphAPIImpl");
-            neo4jIncludedForTesting = true;
+            return true;
         } catch (Exception ex) {
-            neo4jIncludedForTesting = false;
+            return false;
         }
+    }
+
+    protected static void assumeNeo4jIsPresent() {
+        boolean neo4jIncludedForTesting = isNeo4jPresent();
         assumeThat("Neo4j implementation was not included for testing - run 
with -DincludeNeo4j", neo4jIncludedForTesting, is(true));
     }
 }
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index 2eb6aa7..9b4129c 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -185,16 +185,14 @@ public class GremlinDriverIntegrateTest extends 
AbstractGremlinServerIntegration
             case 
"shouldExecuteScriptInSessionOnTransactionalWithManualTransactionsGraph":
             case 
"shouldExecuteInSessionAndSessionlessWithoutOpeningTransaction":
             case "shouldManageTransactionsInSession":
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "shouldRequireAliasedGraphVariablesInStrictTransactionMode":
                 settings.strictTransactionManagement = true;
                 break;
             case "shouldAliasGraphVariablesInStrictTransactionMode":
                 settings.strictTransactionManagement = true;
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "shouldProcessSessionRequestsInOrderAfterTimeout":
                 settings.evaluationTimeout = 250;
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
index 8916ee9..9eefa76 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
@@ -73,13 +73,11 @@ public class GremlinServerHttpIntegrateTest extends 
AbstractGremlinServerIntegra
                 settings.maxContentLength = 31;
                 break;
             case "should200OnPOSTTransactionalGraph":
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "should200OnPOSTTransactionalGraphInStrictMode":
+                tryIncludeNeo4jGraph(settings);
                 settings.strictTransactionManagement = true;
-                deleteDirectory(new File("/tmp/neo4j"));
-                settings.graphs.put("graph", "conf/neo4j-empty.properties");
                 break;
             case 
"should200OnPOSTWithGraphSON1d0AcceptHeaderDefaultResultToJson":
                 settings.serializers.clear();
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index ddf39d3..5af4f60 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -103,7 +103,10 @@ public class GremlinServerSessionIntegrateTest extends 
AbstractGremlinServerInte
                 break;
             case "shouldBlockAdditionalRequestsDuringClose":
             case "shouldBlockAdditionalRequestsDuringForceClose":
-                clearNeo4j(settings);
+            case 
"shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
+            case "shouldExecuteInSessionWithTransactionManagement":
+            case "shouldRollbackOnEvalExceptionForManagedTransaction":
+                tryIncludeNeo4jGraph(settings);
                 break;
             case "shouldEnsureSessionBindingsAreThreadSafe":
                 settings.threadPoolWorker = 2;
@@ -116,21 +119,11 @@ public class GremlinServerSessionIntegrateTest extends 
AbstractGremlinServerInte
                 
processorSettingsForDisableFunctionCache.config.put(SessionOpProcessor.CONFIG_GLOBAL_FUNCTION_CACHE_ENABLED,
 false);
                 
settings.processors.add(processorSettingsForDisableFunctionCache);
                 break;
-            case 
"shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
-            case "shouldExecuteInSessionWithTransactionManagement":
-            case "shouldRollbackOnEvalExceptionForManagedTransaction":
-                clearNeo4j(settings);
-                break;
         }
 
         return settings;
     }
 
-    private static void clearNeo4j(Settings settings) {
-        deleteDirectory(new File("/tmp/neo4j"));
-        settings.graphs.put("graph", "conf/neo4j-empty.properties");
-    }
-
     @Test
     public void shouldUseGlobalFunctionCache() throws Exception {
         final Cluster cluster = TestClientFactory.open();

Reply via email to