Skip to content

Commit

Permalink
Fix flaky test.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-simons committed Nov 25, 2024
1 parent 068e065 commit d949f5a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions neo4j-ogm-tests/neo4j-ogm-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -264,14 +265,18 @@
<goals>
<goal>test</goal>
</goals>
<configuration>
<configuration combine.self="override">
<!--
The tests for correct handling of overlapping native ids for nodes and relationships
(see GH-952) need to be executed on a clean Neo4j instance
-->
<includes>
<include>org.neo4j.ogm.persistence.session.capability.QueryCapabilityGH952Test</include>
</includes>
<systemPropertyVariables>
<neo4j.edition>${neo4j.edition}</neo4j.edition>
<disableContainerReuse>true</disableContainerReuse>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import java.util.Collections;

import org.assertj.core.api.BDDAssertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.neo4j.ogm.domain.gh952.BookWasReadBy;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.neo4j.ogm.testutil.TestContainersTestBase;
import org.testcontainers.utility.TestcontainersConfiguration;

/**
* This test class is specifically for GH-952 and needs to be executed separately within a clean JVM and new Neo4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ public class TestContainersTestBase {

boolean containerReuseSupported = TestcontainersConfiguration
.getInstance().environmentSupportsReuse();
boolean disableContainerReuse = Boolean.getBoolean("disableContainerReuse");
if (disableContainerReuse) {
LOGGER.info("Reuse is explicitly disable");
}
neo4jServer = new Neo4jContainer<>(imageName)
.withReuse(containerReuseSupported);

.withReuse(containerReuseSupported && !disableContainerReuse);
if (acceptAndUseCommercialEdition) {
neo4jServer.withEnv("NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes");
}
Expand Down

0 comments on commit d949f5a

Please sign in to comment.