diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/HeapDumpWebEndpointWebIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/HeapDumpWebEndpointWebIntegrationTests.java index 866bb584c4..8d88cd7dba 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/HeapDumpWebEndpointWebIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/HeapDumpWebEndpointWebIntegrationTests.java @@ -69,6 +69,14 @@ public class HeapDumpWebEndpointWebIntegrationTests { client.get().uri("/application/heapdump").exchange().expectStatus().isOk() .expectHeader().contentType(MediaType.APPLICATION_OCTET_STREAM) .expectBody(String.class).isEqualTo("HEAPDUMP"); + assertHeapDumpFileIsDeleted(); + } + + private void assertHeapDumpFileIsDeleted() throws InterruptedException { + long end = System.currentTimeMillis() + 5000; + while (System.currentTimeMillis() < end && this.endpoint.file.exists()) { + Thread.sleep(100); + } assertThat(this.endpoint.file.exists()).isFalse(); }