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 5da747d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
10 changes: 8 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,19 @@
<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>
<NEO4J_OGM_NEO4J_IMAGE_NAME>neo4j:5.20</NEO4J_OGM_NEO4J_IMAGE_NAME>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
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.junit.jupiter.api.condition.EnabledIf;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.neo4j.ogm.domain.gh952.BookWasReadBy;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
Expand All @@ -36,6 +39,7 @@
*
* @author Niels Oertel
*/
@EnabledIfSystemProperty(named = "GH952NativeIdTest", matches = "true")
public class QueryCapabilityGH952Test extends TestContainersTestBase {

private SessionFactory sessionFactory;
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.warn("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 5da747d

Please sign in to comment.