Ignore exceptions when deleting caches in bind cache tests

See gh-40760
This commit is contained in:
Scott Frederick 2024-05-16 22:19:04 -05:00
parent bdc6508b62
commit d38c1e06b3
2 changed files with 22 additions and 4 deletions

View File

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

View File

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