Skip to content

Commit 68e5bd9

Browse files
authored
Use lenient docker checks (#824)
This commit changes how docker checks are done, so that if the docker environment is detected, then nothing changes, but if it is not, then we would still try to start a container, because it seems that in some cases, the docker environment is present but not properly detected, or detected too late. In this case, we will now display a warning, and let the docker check re-execute for the next container.
1 parent c4846a7 commit 68e5bd9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test-resources-testcontainers/src/main/java/io/micronaut/testresources/testcontainers/DockerSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public static boolean isDockerAvailable() {
7777
LOCK.lock();
7878
try {
7979
available = AVAILABLE.get();
80-
if (available != null) {
80+
// Allow re-checking later in time
81+
if (Boolean.TRUE.equals(available)) {
8182
return available;
8283
}
8384
available = performDockerCheck();

test-resources-testcontainers/src/main/java/io/micronaut/testresources/testcontainers/TestContainers.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ static <T extends GenericContainer<? extends T>> T getOrCreate(String requestedP
126126
LOGGER.info("Starting test container {}", name);
127127
container.start();
128128
} else {
129-
throw new TestResourcesResolutionException("Cannot start container " + name + " as Docker doesn't seem to be available");
129+
LOGGER.info("Trying to start container {} but it is likely to fail as Docker doesn't seem to be available", name);
130+
container.start();
130131
}
131132
} finally {
132133
notifyEndOperation(STARTING, dockerImageName);

0 commit comments

Comments
 (0)