From 46cef32ebd03fa7e5604cf6b45d9d77cdd720e7b Mon Sep 17 00:00:00 2001 From: bono007 Date: Sun, 15 Aug 2021 20:48:13 -0500 Subject: [PATCH 1/2] Add configuration for multiple paths for DiskSpaceHealthIndicator Fixed gh-18359 --- ...aceHealthContributorAutoConfiguration.java | 14 +- .../DiskSpaceHealthIndicatorProperties.java | 56 +++++--- ...althContributorAutoConfigurationTests.java | 63 +++++++-- .../system/DiskSpaceHealthIndicator.java | 58 +++++--- .../system/DiskSpaceHealthIndicatorTests.java | 125 +++++++++++++----- 5 files changed, 231 insertions(+), 85 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfiguration.java index a23c85779201..4167724879cd 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,14 @@ package org.springframework.boot.actuate.autoconfigure.system; +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.stream.Collectors; + import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; +import org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorProperties.PathInfo; import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -25,6 +31,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.util.unit.DataSize; /** * {@link EnableAutoConfiguration Auto-configuration} for @@ -32,6 +39,7 @@ * * @author Mattias Severson * @author Andy Wilkinson + * @author Chris Bono * @since 2.0.0 */ @Configuration(proxyBeanMethods = false) @@ -43,7 +51,9 @@ public class DiskSpaceHealthContributorAutoConfiguration { @Bean @ConditionalOnMissingBean(name = "diskSpaceHealthIndicator") public DiskSpaceHealthIndicator diskSpaceHealthIndicator(DiskSpaceHealthIndicatorProperties properties) { - return new DiskSpaceHealthIndicator(properties.getPath(), properties.getThreshold()); + Map paths = properties.getPaths().stream() + .collect(Collectors.toMap(PathInfo::getPath, PathInfo::getThreshold, (u, v) -> u, LinkedHashMap::new)); + return new DiskSpaceHealthIndicator(paths); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java index f2b625463ad2..bce74ef3f3da 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ package org.springframework.boot.actuate.autoconfigure.system; import java.io.File; +import java.util.Arrays; +import java.util.List; import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -28,36 +30,54 @@ * * @author Andy Wilkinson * @author Stephane Nicoll + * @author Chris Bono * @since 1.2.0 */ @ConfigurationProperties(prefix = "management.health.diskspace") public class DiskSpaceHealthIndicatorProperties { /** - * Path used to compute the available disk space. + * Paths to consider for computing the available disk space. */ - private File path = new File("."); + private List paths = Arrays.asList(new PathInfo()); - /** - * Minimum disk space that should be available. - */ - private DataSize threshold = DataSize.ofMegabytes(10); - - public File getPath() { - return this.path; + public List getPaths() { + return this.paths; } - public void setPath(File path) { - this.path = path; + public void setPaths(List paths) { + this.paths = paths; } - public DataSize getThreshold() { - return this.threshold; - } + public static class PathInfo { + + /** + * Path used to compute the available disk space. + */ + private File path = new File("."); + + /** + * Minimum disk space that should be available. + */ + private DataSize threshold = DataSize.ofMegabytes(10); + + public File getPath() { + return this.path; + } + + public void setPath(File path) { + this.path = path; + } + + public DataSize getThreshold() { + return this.threshold; + } + + public void setThreshold(DataSize threshold) { + Assert.isTrue(!threshold.isNegative(), "threshold must be greater than or equal to 0"); + this.threshold = threshold; + } - public void setThreshold(DataSize threshold) { - Assert.isTrue(!threshold.isNegative(), "threshold must be greater than or equal to 0"); - this.threshold = threshold; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java index 1e5ac554b84f..6c950490e9db 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,21 +16,29 @@ package org.springframework.boot.actuate.autoconfigure.system; +import java.io.File; +import java.util.Map; + +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration; import org.springframework.boot.actuate.system.DiskSpaceHealthIndicator; import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.assertj.AssertableApplicationContext; import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.util.unit.DataSize; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; /** * Tests for {@link DiskSpaceHealthContributorAutoConfiguration}. * * @author Phillip Webb * @author Stephane Nicoll + * @author Chris Bono */ class DiskSpaceHealthContributorAutoConfigurationTests { @@ -39,29 +47,49 @@ class DiskSpaceHealthContributorAutoConfigurationTests { HealthContributorAutoConfiguration.class)); @Test - void runShouldCreateIndicator() { - this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class)); + void runShouldCreateIndicatorWithDefaultSinglePathAndThreshold() { + this.contextRunner + .run((context) -> validateIndicatorHasPathsExactly(entry(new File("."), DataSize.ofMegabytes(10)))); } @Test - void thresholdMustBePositive() { - this.contextRunner.withPropertyValues("management.health.diskspace.threshold=-10MB") - .run((context) -> assertThat(context).hasFailed().getFailure() - .hasMessageContaining("Failed to bind properties under 'management.health.diskspace'")); + void pathCanBeCustomized() { + this.contextRunner.withPropertyValues("management.health.diskspace.paths[0].path=..") + .run((context) -> validateIndicatorHasPathsExactly(entry(new File(".."), DataSize.ofMegabytes(10)))); } @Test void thresholdCanBeCustomized() { - this.contextRunner.withPropertyValues("management.health.diskspace.threshold=20MB").run((context) -> { - assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class); - assertThat(context.getBean(DiskSpaceHealthIndicator.class)).hasFieldOrPropertyWithValue("threshold", - DataSize.ofMegabytes(20)); - }); + this.contextRunner.withPropertyValues("management.health.diskspace.paths[0].threshold=20MB") + .run((context) -> validateIndicatorHasPathsExactly(entry(new File("."), DataSize.ofMegabytes(20)))); + } + + @Test + void pathAndThresholdCanBeCustomized() { + this.contextRunner + .withPropertyValues("management.health.diskspace.paths[0].path=..", + "management.health.diskspace.paths[0].threshold=20MB") + .run((context) -> validateIndicatorHasPathsExactly(entry(new File(".."), DataSize.ofMegabytes(20)))); + } + + @Test + void multiplePathsCanBeConfigured() { + this.contextRunner.withPropertyValues("management.health.diskspace.paths[0].path=.", + "management.health.diskspace.paths[1].path=..", "management.health.diskspace.paths[1].threshold=33MB") + .run((context) -> validateIndicatorHasPathsExactly(entry(new File("."), DataSize.ofMegabytes(10)), + entry(new File(".."), DataSize.ofMegabytes(33)))); + } + + @Test + void thresholdMustBePositive() { + this.contextRunner.withPropertyValues("management.health.diskspace.paths[0].threshold=-10MB") + .run((context) -> assertThat(context).hasFailed().getFailure().getCause().hasMessageContaining( + "Failed to bind properties under 'management.health.diskspace.paths[0]'")); } @Test void runWhenPathDoesNotExistShouldCreateIndicator() { - this.contextRunner.withPropertyValues("management.health.diskspace.path=does/not/exist") + this.contextRunner.withPropertyValues("management.health.diskspace.paths[0].path=does/not/exist") .run((context) -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class)); } @@ -71,4 +99,13 @@ void runWhenDisabledShouldNotCreateIndicator() { .run((context) -> assertThat(context).doesNotHaveBean(DiskSpaceHealthIndicator.class)); } + @SafeVarargs + @SuppressWarnings("varargs") + private final ContextConsumer validateIndicatorHasPathsExactly( + Map.Entry... entries) { + return (context -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class) + .getBean(DiskSpaceHealthIndicator.class).extracting("paths") + .asInstanceOf(InstanceOfAssertFactories.map(File.class, DataSize.class)).containsExactly(entries)); + } + } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java index bf3919a5e565..a11a68794d36 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ package org.springframework.boot.actuate.system; import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -29,46 +31,66 @@ import org.springframework.util.unit.DataSize; /** - * A {@link HealthIndicator} that checks available disk space and reports a status of - * {@link Status#DOWN} when it drops below a configurable threshold. + * A {@link HealthIndicator} that checks one or more paths for available disk space and + * reports a status of {@link Status#DOWN} when any of the paths drops below a + * configurable threshold. * * @author Mattias Severson * @author Andy Wilkinson * @author Stephane Nicoll + * @author Chris Bono * @since 2.0.0 */ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { private static final Log logger = LogFactory.getLog(DiskSpaceHealthIndicator.class); - private final File path; - - private final DataSize threshold; + private final Map paths = new LinkedHashMap<>(); /** - * Create a new {@code DiskSpaceHealthIndicator} instance. + * Create a new {@code DiskSpaceHealthIndicator} instance for a single path. * @param path the Path used to compute the available disk space * @param threshold the minimum disk space that should be available */ public DiskSpaceHealthIndicator(File path, DataSize threshold) { super("DiskSpace health check failed"); - this.path = path; - this.threshold = threshold; + this.paths.put(path, threshold); + } + + /** + * Create a new {@code DiskSpaceHealthIndicator} instance for one or more paths. + * @param paths the paths to compute available disk space for and their corresponding + * minimum disk space that should be available. + */ + public DiskSpaceHealthIndicator(Map paths) { + super("DiskSpace health check failed"); + this.paths.putAll(paths); } @Override protected void doHealthCheck(Health.Builder builder) throws Exception { - long diskFreeInBytes = this.path.getUsableSpace(); - if (diskFreeInBytes >= this.threshold.toBytes()) { - builder.up(); - } - else { - logger.warn(LogMessage.format("Free disk space below threshold. Available: %d bytes (threshold: %s)", - diskFreeInBytes, this.threshold)); + // assume all is well - prove otherwise when checking paths + builder.up(); + + Map> details = new LinkedHashMap<>(); + this.paths.forEach((path, threshold) -> details.put(path.getAbsolutePath(), + checkPathAndGetDetails(path, threshold, builder))); + builder.withDetail("paths", details); + } + + private Map checkPathAndGetDetails(File path, DataSize threshold, Health.Builder builder) { + long diskFreeInBytes = path.getUsableSpace(); + if (diskFreeInBytes < threshold.toBytes()) { + logger.warn(LogMessage.format("Free disk space in %s below threshold. Available: %d bytes (threshold: %s)", + path.getAbsolutePath(), diskFreeInBytes, threshold)); builder.down(); } - builder.withDetail("total", this.path.getTotalSpace()).withDetail("free", diskFreeInBytes) - .withDetail("threshold", this.threshold.toBytes()).withDetail("exists", this.path.exists()); + Map pathDetails = new LinkedHashMap<>(); + pathDetails.put("total", path.getTotalSpace()); + pathDetails.put("free", diskFreeInBytes); + pathDetails.put("threshold", threshold.toBytes()); + pathDetails.put("exists", path.exists()); + return pathDetails; } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java index b631c492bd43..0e223fd5fb84 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/system/DiskSpaceHealthIndicatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,11 @@ package org.springframework.boot.actuate.system; import java.io.File; +import java.util.HashMap; +import java.util.Map; -import org.junit.jupiter.api.BeforeEach; +import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; @@ -31,65 +30,123 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; /** * Tests for {@link DiskSpaceHealthIndicator}. * * @author Mattias Severson * @author Stephane Nicoll + * @author Chris Bono */ -@ExtendWith(MockitoExtension.class) class DiskSpaceHealthIndicatorTests { private static final DataSize THRESHOLD = DataSize.ofKilobytes(1); private static final DataSize TOTAL_SPACE = DataSize.ofKilobytes(10); - @Mock - private File fileMock; + @Test + void diskSpaceIsUpWithSinglePath() { + long freeSpace = THRESHOLD.toBytes() + 10; + File mockFile = setupMockFile("file1", freeSpace); + HealthIndicator healthIndicator = new DiskSpaceHealthIndicator(mockFile, THRESHOLD); + + Health health = healthIndicator.health(); + + assertThat(health.getStatus()).isEqualTo(Status.UP); + assertPathDetails(health, "file1", freeSpace); + } + + @Test + void diskSpaceIsDownWithSinglePath() { + long freeSpace = THRESHOLD.toBytes() - 10; + File mockFile = setupMockFile("file1", freeSpace); + HealthIndicator healthIndicator = new DiskSpaceHealthIndicator(mockFile, THRESHOLD); - private HealthIndicator healthIndicator; + Health health = healthIndicator.health(); - @BeforeEach - void setUp() { - this.healthIndicator = new DiskSpaceHealthIndicator(this.fileMock, THRESHOLD); + assertThat(health.getStatus()).isEqualTo(Status.DOWN); + assertPathDetails(health, "file1", freeSpace); } @Test - void diskSpaceIsUp() { - given(this.fileMock.exists()).willReturn(true); + void diskSpaceIsUpWithMultiplePaths() { long freeSpace = THRESHOLD.toBytes() + 10; - given(this.fileMock.getUsableSpace()).willReturn(freeSpace); - given(this.fileMock.getTotalSpace()).willReturn(TOTAL_SPACE.toBytes()); - Health health = this.healthIndicator.health(); + File mockFile1 = setupMockFile("file1", freeSpace); + File mockFile2 = setupMockFile("file2", freeSpace); + Map paths = new HashMap<>(); + paths.put(mockFile1, THRESHOLD); + paths.put(mockFile2, THRESHOLD); + HealthIndicator healthIndicator = new DiskSpaceHealthIndicator(paths); + + Health health = healthIndicator.health(); + assertThat(health.getStatus()).isEqualTo(Status.UP); - assertThat(health.getDetails().get("threshold")).isEqualTo(THRESHOLD.toBytes()); - assertThat(health.getDetails().get("free")).isEqualTo(freeSpace); - assertThat(health.getDetails().get("total")).isEqualTo(TOTAL_SPACE.toBytes()); - assertThat(health.getDetails().get("exists")).isEqualTo(true); + assertPathDetails(health, "file1", freeSpace); + assertPathDetails(health, "file2", freeSpace); } @Test - void diskSpaceIsDown() { - given(this.fileMock.exists()).willReturn(true); + void diskSpaceIsDownWithMultiplePathsAllOverThreshold() { long freeSpace = THRESHOLD.toBytes() - 10; - given(this.fileMock.getUsableSpace()).willReturn(freeSpace); - given(this.fileMock.getTotalSpace()).willReturn(TOTAL_SPACE.toBytes()); - Health health = this.healthIndicator.health(); + File mockFile1 = setupMockFile("file1", freeSpace); + File mockFile2 = setupMockFile("file2", freeSpace); + Map paths = new HashMap<>(); + paths.put(mockFile1, THRESHOLD); + paths.put(mockFile2, THRESHOLD); + HealthIndicator healthIndicator = new DiskSpaceHealthIndicator(paths); + + Health health = healthIndicator.health(); + assertThat(health.getStatus()).isEqualTo(Status.DOWN); - assertThat(health.getDetails().get("threshold")).isEqualTo(THRESHOLD.toBytes()); - assertThat(health.getDetails().get("free")).isEqualTo(freeSpace); - assertThat(health.getDetails().get("total")).isEqualTo(TOTAL_SPACE.toBytes()); - assertThat(health.getDetails().get("exists")).isEqualTo(true); + assertPathDetails(health, "file1", freeSpace); + assertPathDetails(health, "file2", freeSpace); + } + + @Test + void diskSpaceIsDownWithMultiplePathsOneOverThreshold() { + long freeSpace = THRESHOLD.toBytes() + 10; + File mockFile1 = setupMockFile("file1", freeSpace); + + long freeSpaceOver = THRESHOLD.toBytes() - 10; + File mockFile2 = setupMockFile("file2", freeSpaceOver); + + Map paths = new HashMap<>(); + paths.put(mockFile1, THRESHOLD); + paths.put(mockFile2, THRESHOLD); + HealthIndicator healthIndicator = new DiskSpaceHealthIndicator(paths); + + Health health = healthIndicator.health(); + + assertThat(health.getStatus()).isEqualTo(Status.DOWN); + assertPathDetails(health, "file1", freeSpace); + assertPathDetails(health, "file2", freeSpaceOver); } @Test void whenPathDoesNotExistDiskSpaceIsDown() { - Health health = new DiskSpaceHealthIndicator(new File("does/not/exist"), THRESHOLD).health(); + File noSuchFile = new File("does/not/exist"); + Health health = new DiskSpaceHealthIndicator(noSuchFile, THRESHOLD).health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); - assertThat(health.getDetails().get("free")).isEqualTo(0L); - assertThat(health.getDetails().get("total")).isEqualTo(0L); - assertThat(health.getDetails().get("exists")).isEqualTo(false); + assertThat(health.getDetails()).extractingByKey("paths", InstanceOfAssertFactories.MAP) + .extractingByKey(noSuchFile.getAbsolutePath(), InstanceOfAssertFactories.MAP).containsEntry("free", 0L) + .containsEntry("total", 0L).containsEntry("exists", false); + } + + private File setupMockFile(String path, long usableSpace) { + File mockFile = mock(File.class); + given(mockFile.exists()).willReturn(true); + given(mockFile.getAbsolutePath()).willReturn(path); + given(mockFile.getUsableSpace()).willReturn(usableSpace); + given(mockFile.getTotalSpace()).willReturn(TOTAL_SPACE.toBytes()); + return mockFile; + } + + private void assertPathDetails(Health health, String path, long expectedFreeSpace) { + assertThat(health.getDetails()).extractingByKey("paths", InstanceOfAssertFactories.MAP) + .extractingByKey(path, InstanceOfAssertFactories.MAP).containsEntry("threshold", THRESHOLD.toBytes()) + .containsEntry("free", expectedFreeSpace).containsEntry("total", TOTAL_SPACE.toBytes()) + .containsEntry("exists", true); } } From 19c200ef7871a51a21e9d311c5f20f05d181b02a Mon Sep 17 00:00:00 2001 From: bono007 Date: Mon, 16 Aug 2021 10:24:56 -0500 Subject: [PATCH 2/2] Fix checkstyle. --- .../DiskSpaceHealthContributorAutoConfigurationTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java index 6c950490e9db..f4a676f05407 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthContributorAutoConfigurationTests.java @@ -103,9 +103,9 @@ void runWhenDisabledShouldNotCreateIndicator() { @SuppressWarnings("varargs") private final ContextConsumer validateIndicatorHasPathsExactly( Map.Entry... entries) { - return (context -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class) + return (context) -> assertThat(context).hasSingleBean(DiskSpaceHealthIndicator.class) .getBean(DiskSpaceHealthIndicator.class).extracting("paths") - .asInstanceOf(InstanceOfAssertFactories.map(File.class, DataSize.class)).containsExactly(entries)); + .asInstanceOf(InstanceOfAssertFactories.map(File.class, DataSize.class)).containsExactly(entries); } }