Browse Source

Ignore exceptions when deleting caches in bind cache tests

See gh-40760
pull/41000/head
Scott Frederick 2 years ago
parent
commit
d38c1e06b3
  1. 13
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java
  2. 13
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageTests.java

13
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImageIntegrationTests.java

@ -317,8 +317,17 @@ class BootBuildImageIntegrationTests { @@ -317,8 +317,17 @@ class BootBuildImageIntegrationTests {
Path launchCachePath = Paths.get(tempDir, "junit-image-cache-" + projectName + "-launch");
assertThat(buildCachePath).exists().isDirectory();
assertThat(launchCachePath).exists().isDirectory();
FileSystemUtils.deleteRecursively(buildCachePath);
FileSystemUtils.deleteRecursively(launchCachePath);
cleanupCache(buildCachePath);
cleanupCache(launchCachePath);
}
private static void cleanupCache(Path buildCachePath) {
try {
FileSystemUtils.deleteRecursively(buildCachePath);
}
catch (Exception ex) {
// ignore
}
}
@TestTemplate

13
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/BuildImageTests.java

@ -419,11 +419,20 @@ class BuildImageTests extends AbstractArchiveIntegrationTests { @@ -419,11 +419,20 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
Path launchCachePath = Paths.get(tempDir, "junit-image-cache-" + testBuildId + "-launch");
assertThat(buildCachePath).exists().isDirectory();
assertThat(launchCachePath).exists().isDirectory();
FileSystemUtils.deleteRecursively(buildCachePath);
FileSystemUtils.deleteRecursively(launchCachePath);
cleanupCache(buildCachePath);
cleanupCache(launchCachePath);
});
}
private static void cleanupCache(Path buildCachePath) {
try {
FileSystemUtils.deleteRecursively(buildCachePath);
}
catch (Exception ex) {
// ignore
}
}
@TestTemplate
void whenBuildImageIsInvokedWithCreatedDate(MavenBuild mavenBuild) {
String testBuildId = randomString();

Loading…
Cancel
Save