Test that total space is included in disk health information

Closes gh-2705
This commit is contained in:
Andy Wilkinson 2015-03-30 13:40:16 +01:00
parent e270a21b82
commit ee3521b6a2
1 changed files with 4 additions and 0 deletions

View File

@ -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) {