Skip to content

Commit

Permalink
Fixes #4262: Add startup test for SLF4J (#4308)
Browse files Browse the repository at this point in the history
* Fixes #4262: Add startup test for SLF4J

* try removing api dep
  • Loading branch information
vga91 authored Dec 19, 2024
1 parent 6bb59e9 commit aa961c8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import apoc.util.Neo4jContainerExtension;
import apoc.util.TestContainerUtil;
import apoc.util.TestContainerUtil.Neo4jVersion;
import apoc.util.TestUtil;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.neo4j.driver.Session;
Expand All @@ -23,7 +24,9 @@
import static apoc.util.TestContainerUtil.ApocPackage.CORE;
import static apoc.util.TestContainerUtil.ApocPackage.EXTENDED;
import static apoc.util.TestContainerUtil.createDB;
import static apoc.util.TestContainerUtil.dockerImageForNeo4j;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -110,6 +113,11 @@ private void startContainerSessionWithExtraDeps(Function<Neo4jVersion, Neo4jCont
neo4jContainer.start();
assertTrue("Neo4j Instance should be up-and-running", neo4jContainer.isRunning());

String startupLog = neo4jContainer.getLogs();

assertFalse(startupLog.contains("SLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\""));
assertFalse(startupLog.contains("SLF4J: Class path contains multiple SLF4J providers"));

final Session session = neo4jContainer.getSession();

sessionConsumer.accept(session);
Expand All @@ -118,8 +126,10 @@ private void startContainerSessionWithExtraDeps(Function<Neo4jVersion, Neo4jCont
if (TestContainerUtil.isDockerImageAvailable(ex)) {
ex.printStackTrace();
fail("Should not have thrown exception when trying to start Neo4j: " + ex);
} else if (!TestUtil.isRunningInCI()) {
fail( "The docker image " + dockerImageForNeo4j(version) + " could not be loaded. Check whether it's available locally / in the CI. Exception:" + ex);
} else {
fail("The docker image could not be loaded. Check whether it's available locally / in the CI. Exception:" + ex);
fail( "The docker image " + dockerImageForNeo4j(version) + " could not be loaded. Check whether it's available locally / in the CI. Exception:" + ex);
}
}
}
Expand Down

0 comments on commit aa961c8

Please sign in to comment.