Skip to content

Commit 75274d3

Browse files
committed
Merge branch '1.5.x'
2 parents 35d062f + fc57a0e commit 75274d3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public DiskSpaceHealthIndicator(DiskSpaceHealthIndicatorProperties properties) {
4646
@Override
4747
protected void doHealthCheck(Health.Builder builder) throws Exception {
4848
File path = this.properties.getPath();
49-
long diskFreeInBytes = path.getFreeSpace();
49+
long diskFreeInBytes = path.getUsableSpace();
5050
if (diskFreeInBytes >= this.properties.getThreshold()) {
5151
builder.up();
5252
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public void setUp() throws Exception {
5656

5757
@Test
5858
public void diskSpaceIsUp() throws Exception {
59-
given(this.fileMock.getFreeSpace()).willReturn(THRESHOLD_BYTES + 10);
59+
given(this.fileMock.getUsableSpace()).willReturn(THRESHOLD_BYTES + 10);
6060
given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10);
6161
Health health = this.healthIndicator.health();
6262
assertThat(health.getStatus()).isEqualTo(Status.UP);
@@ -67,7 +67,7 @@ public void diskSpaceIsUp() throws Exception {
6767

6868
@Test
6969
public void diskSpaceIsDown() throws Exception {
70-
given(this.fileMock.getFreeSpace()).willReturn(THRESHOLD_BYTES - 10);
70+
given(this.fileMock.getUsableSpace()).willReturn(THRESHOLD_BYTES - 10);
7171
given(this.fileMock.getTotalSpace()).willReturn(THRESHOLD_BYTES * 10);
7272
Health health = this.healthIndicator.health();
7373
assertThat(health.getStatus()).isEqualTo(Status.DOWN);

0 commit comments

Comments
 (0)