Browse Source

Test that total space is included in disk health information

Closes gh-2705
pull/2252/merge
Andy Wilkinson 11 years ago
parent
commit
ee3521b6a2
  1. 4
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java

4
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicatorTests.java

@ -58,19 +58,23 @@ public class DiskSpaceHealthIndicatorTests { @@ -58,19 +58,23 @@ public class DiskSpaceHealthIndicatorTests {
@Test
public void diskSpaceIsUp() throws Exception {
given(this.fileMock.getFreeSpace()).willReturn(THRESHOLD_BYTES + 10);
given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10);
Health health = this.healthIndicator.health();
assertEquals(Status.UP, health.getStatus());
assertEquals(THRESHOLD_BYTES, health.getDetails().get("threshold"));
assertEquals(THRESHOLD_BYTES + 10, health.getDetails().get("free"));
assertEquals(THRESHOLD_BYTES * 10, health.getDetails().get("total"));
}
@Test
public void diskSpaceIsDown() throws Exception {
given(this.fileMock.getFreeSpace()).willReturn(THRESHOLD_BYTES - 10);
given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10);
Health health = this.healthIndicator.health();
assertEquals(Status.DOWN, health.getStatus());
assertEquals(THRESHOLD_BYTES, health.getDetails().get("threshold"));
assertEquals(THRESHOLD_BYTES - 10, health.getDetails().get("free"));
assertEquals(THRESHOLD_BYTES * 10, health.getDetails().get("total"));
}
private DiskSpaceHealthIndicatorProperties createProperties(File path, long threshold) {

Loading…
Cancel
Save