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");
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

View File

@ -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();