Skip to content

Commit

Permalink
Conditionally enable image building bind cache tests
Browse files Browse the repository at this point in the history
Accessing bind mount directories as is done in the tests for building
images with bind mount caches requires Docker configuration when
using Docker Desktop. It works without configuration on Linux with
Docker Engine.

See gh-28387
  • Loading branch information
scottfrederick committed Sep 12, 2023
1 parent 291d410 commit a9f26e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.TaskOutcome;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;

import org.springframework.boot.buildpack.platform.docker.DockerApi;
Expand Down Expand Up @@ -299,6 +300,8 @@ void buildsImageWithVolumeCaches() throws IOException {
}

@TestTemplate
@EnabledOnOs(value = OS.LINUX, disabledReason = "Works with Docker Engine on Linux but is not reliable with "
+ "Docker Desktop on other OSs")
void buildsImageWithBindCaches() throws IOException {
writeMainClass();
writeLongNameResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.stream.IntStream;

import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.api.extension.ExtendWith;

Expand Down Expand Up @@ -400,6 +401,8 @@ void whenBuildImageIsInvokedWithVolumeCaches(MavenBuild mavenBuild) {
}

@TestTemplate
@EnabledOnOs(value = OS.LINUX, disabledReason = "Works with Docker Engine on Linux but is not reliable with "
+ "Docker Desktop on other OSs")
void whenBuildImageIsInvokedWithBindCaches(MavenBuild mavenBuild) {
String testBuildId = randomString();
mavenBuild.project("build-image-bind-caches")
Expand Down

0 comments on commit a9f26e0

Please sign in to comment.