Skip to content

Commit 286b9f8

Browse files
committed
Add test for DiskSpaceHealthIndicator path
1 parent b546415 commit 286b9f8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.system;
1818

19+
import java.util.UUID;
20+
1921
import org.junit.jupiter.api.Test;
2022

2123
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
@@ -58,6 +60,14 @@ void thresholdCanBeCustomized() {
5860
});
5961
}
6062

63+
@Test
64+
void pathMustExist() {
65+
String randomPath = "IDoNOTeXiST" + UUID.randomUUID().toString();
66+
this.contextRunner.withPropertyValues("management.health.diskspace.path=" + randomPath)
67+
.run((context) -> assertThat(context).hasFailed().getFailure()
68+
.hasStackTraceContaining("Path '" + randomPath + "' does not exist"));
69+
}
70+
6171
@Test
6272
void runWhenDisabledShouldNotCreateIndicator() {
6373
this.contextRunner.withPropertyValues("management.health.diskspace.enabled:false")

0 commit comments

Comments
 (0)