Skip to content

Make container runtime expected in build environment #1315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.neo4j.driver.AuthToken;
import org.neo4j.driver.Config;
import org.neo4j.driver.exceptions.SessionExpiredException;
import org.neo4j.driver.testutil.cc.LocalOrRemoteClusterExtension;
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers(disabledWithoutDocker = true)
@DisabledIfSystemProperty(named = "skipDockerTests", matches = "^true$")
class CausalClusteringStressIT extends AbstractStressTestBase<CausalClusteringStressIT.Context> {
@RegisterExtension
static final LocalOrRemoteClusterExtension clusterRule = new LocalOrRemoteClusterExtension();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.Neo4jContainer;
import org.testng.SkipException;

Expand All @@ -39,18 +38,10 @@ public Driver getDriver() {
return GraphDatabase.driver(NEO4J.getBoltUrl());
}

public void skipIfDockerUnavailable() {
if (!isDockerAvailable()) {
public void skipIfDockerTestsSkipped() {
var skip = System.getProperty("skipDockerTests");
if (skip != null && skip.equals(Boolean.TRUE.toString())) {
throw new SkipException("Docker is unavailable");
}
}

private boolean isDockerAvailable() {
try {
DockerClientFactory.instance().client();
return true;
} catch (Throwable ex) {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
import org.reactivestreams.Publisher;
import org.reactivestreams.tck.PublisherVerification;
import org.reactivestreams.tck.TestEnvironment;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import reactor.core.publisher.Mono;

@Testcontainers(disabledWithoutDocker = true)
public class ReactiveResultPublisherVerificationIT extends PublisherVerification<ReactiveResult> {
private final Neo4jManager NEO4J = new Neo4jManager();
private static final Duration TIMEOUT = Duration.ofSeconds(10);
Expand All @@ -49,7 +47,7 @@ public ReactiveResultPublisherVerificationIT() {

@BeforeClass
public void beforeClass() {
NEO4J.skipIfDockerUnavailable();
NEO4J.skipIfDockerTestsSkipped();
NEO4J.start();
driver = NEO4J.getDriver();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
import org.reactivestreams.Publisher;
import org.reactivestreams.tck.PublisherVerification;
import org.reactivestreams.tck.TestEnvironment;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Testcontainers(disabledWithoutDocker = true)
public class ReactiveResultRecordPublisherVerificationIT extends PublisherVerification<Record> {
private final Neo4jManager NEO4J = new Neo4jManager();
private static final long MAX_NUMBER_OF_RECORDS = 30000;
Expand All @@ -55,7 +53,7 @@ public ReactiveResultRecordPublisherVerificationIT() {

@BeforeClass
public void beforeClass() {
NEO4J.skipIfDockerUnavailable();
NEO4J.skipIfDockerTestsSkipped();
NEO4J.start();
driver = NEO4J.getDriver();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
import org.reactivestreams.Publisher;
import org.reactivestreams.tck.PublisherVerification;
import org.reactivestreams.tck.TestEnvironment;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;

@Testcontainers(disabledWithoutDocker = true)
@SuppressWarnings("deprecation")
public class RxResultRecordPublisherVerificationIT extends PublisherVerification<Record> {
private final Neo4jManager NEO4J = new Neo4jManager();
Expand All @@ -54,7 +52,7 @@ public RxResultRecordPublisherVerificationIT() {

@BeforeClass
public void beforeClass() {
NEO4J.skipIfDockerUnavailable();
NEO4J.skipIfDockerTestsSkipped();
NEO4J.start();
driver = NEO4J.getDriver();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
*/
package org.neo4j.docs.driver;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.net.URI;
import java.util.Optional;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.net.ServerAddress;
import org.testcontainers.containers.Neo4jContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

@Testcontainers(disabledWithoutDocker = true)
import java.net.URI;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertTrue;

@DisabledIfSystemProperty(named = "skipDockerTests", matches = "^true$")
class RoutingExamplesIT {
private static final String NEO4J_VERSION =
Optional.ofNullable(System.getenv("NEO4J_VERSION")).orElse("4.4");
Expand Down
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,25 @@
<parallelizable.it.forkCount>1</parallelizable.it.forkCount>
</properties>
</profile>

<profile>
<id>skip-docker-tests</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<skipDockerTests>true</skipDockerTests>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

<build>
Expand Down