From a9f26e0f95bf6f08e8f01d67efe8f0c446fdadbd Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Tue, 12 Sep 2023 17:00:59 -0500 Subject: [PATCH] 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 --- .../gradle/tasks/bundling/BootBuildImageIntegrationTests.java | 3 +++ .../java/org/springframework/boot/maven/BuildImageTests.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java index 8e3f23eb2c6d..06bc731d634b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java @@ -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; @@ -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(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageTests.java index 8ea336c6a1de..a729404432a5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageTests.java @@ -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; @@ -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")