Browse Source

Test that temp file has been deleted before triggering heap dump

The MBean requires that a file does not exist at the location to which
it’s dumping the heap. This commit updates the test to ensure that the
temporary file that’s created to get a location for the heap dump file
is deleted before asking the MBean to dump the heap to that location.
pull/6414/merge
Andy Wilkinson 10 years ago
parent
commit
fe22609096
  1. 3
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java

3
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/HeapdumpMvcEndpointTests.java

@ -152,6 +152,9 @@ public class HeapdumpMvcEndpointTests { @@ -152,6 +152,9 @@ public class HeapdumpMvcEndpointTests {
if (TestHeapdumpMvcEndpoint.this.locked) {
throw new InterruptedException();
}
if (file.exists()) {
throw new IOException("File exists");
}
FileCopyUtils.copy(TestHeapdumpMvcEndpoint.this.heapDump.getBytes(),
file);
}

Loading…
Cancel
Save