Conditionally enable image building bind cache tests

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
This commit is contained in:
Scott Frederick 2023-09-12 17:00:59 -05:00
parent 291d41093d
commit a9f26e0f95
2 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,7 @@ import org.apache.commons.compress.utils.IOUtils;
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;
@ -299,6 +300,8 @@ class BootBuildImageIntegrationTests {
}
@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();

View File

@ -26,6 +26,7 @@ import java.util.Random;
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;
@ -400,6 +401,8 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
}
@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")