Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ management:
show-details: "always"
cache:
time-to-live: 10s
loggers:
enabled: false
endpoints:
web:
base-path: /
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package uk.gov.hmcts.reform.ccd.documentam.configuration;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.ClassPathResource;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

class ManagementEndpointsConfigurationTest {

@Test
void shouldDisableLoggersEndpointAndLimitExposedActuators() {
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new ClassPathResource("application.yaml"));

var properties = yamlPropertiesFactoryBean.getObject();

assertThat(properties)
.isNotNull();
assertThat(properties.getProperty("management.endpoint.loggers.enabled"))
.isEqualTo("false");
assertThat(List.of(properties.getProperty("management.endpoints.web.exposure.include").split(",\\s*")))
.containsExactly("health", "info", "prometheus")
.doesNotContain("loggers");
}
}