Changes default value of management.endpoint.env.post.enabled to false.
fixes gh-681
This commit is contained in:
@@ -50,20 +50,21 @@ public class LifecycleMvcAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void environmentWebEndpointExtensionDisabled() {
|
||||
beanNotCreated("environmentWebEndpointExtension",
|
||||
beanNotCreated("writableEnvironmentEndpointWebExtension",
|
||||
"management.endpoint.env.enabled=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void environmentWebEndpointExtensionGloballyDisabled() {
|
||||
beanNotCreated("environmentWebEndpointExtension",
|
||||
beanNotCreated("writableEnvironmentEndpointWebExtension",
|
||||
"management.endpoints.enabled-by-default=false");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void environmentWebEndpointExtensionEnabled() {
|
||||
beanCreated("environmentEndpointWebExtension",
|
||||
beanCreated("writableEnvironmentEndpointWebExtension",
|
||||
"management.endpoint.env.enabled=true",
|
||||
"management.endpoint.env.post.enabled=true",
|
||||
"management.endpoints.web.exposure.include=env");
|
||||
}
|
||||
|
||||
@@ -144,16 +145,16 @@ public class LifecycleMvcAutoConfigurationTests {
|
||||
private void beanNotCreated(String beanName, String... contextProperties) {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(Config.class,
|
||||
contextProperties)) {
|
||||
then(context.containsBeanDefinition(beanName)).as("bean was created")
|
||||
.isFalse();
|
||||
then(context.containsBeanDefinition(beanName))
|
||||
.as("%s bean was created", beanName).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
private void beanCreated(String beanName, String... contextProperties) {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(Config.class,
|
||||
contextProperties)) {
|
||||
then(context.containsBeanDefinition(beanName)).as("bean was not created")
|
||||
.isTrue();
|
||||
then(context.containsBeanDefinition(beanName))
|
||||
.as("%s bean was not created", beanName).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,8 +163,8 @@ public class LifecycleMvcAutoConfigurationTests {
|
||||
Function<T, Object> function, String... properties) {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(Config.class,
|
||||
properties)) {
|
||||
then(context.containsBeanDefinition(beanName)).as("bean was not created")
|
||||
.isTrue();
|
||||
then(context.containsBeanDefinition(beanName))
|
||||
.as("%s bean was not created", beanName).isTrue();
|
||||
|
||||
Object endpoint = context.getBean(beanName, type);
|
||||
Object result = function.apply((T) endpoint);
|
||||
|
||||
@@ -52,7 +52,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = TestConfiguration.class,
|
||||
properties = "management.endpoints.web.exposure.include=*")
|
||||
properties = { "management.endpoints.web.exposure.include=*",
|
||||
"management.endpoint.env.post.enabled=true" })
|
||||
@AutoConfigureMockMvc
|
||||
public class EnvironmentManagerIntegrationTests {
|
||||
|
||||
@@ -114,14 +115,14 @@ public class EnvironmentManagerIntegrationTests {
|
||||
public void environmentBeansConfiguredCorrectly() {
|
||||
Map<String, EnvironmentEndpoint> envbeans = this.context
|
||||
.getBeansOfType(EnvironmentEndpoint.class);
|
||||
then(envbeans).hasSize(1).containsKey("environmentEndpoint");
|
||||
then(envbeans.get("environmentEndpoint"))
|
||||
then(envbeans).hasSize(1).containsKey("writableEnvironmentEndpoint");
|
||||
then(envbeans.get("writableEnvironmentEndpoint"))
|
||||
.isInstanceOf(WritableEnvironmentEndpoint.class);
|
||||
|
||||
Map<String, EnvironmentEndpointWebExtension> extbeans = this.context
|
||||
.getBeansOfType(EnvironmentEndpointWebExtension.class);
|
||||
then(extbeans).hasSize(1).containsKey("environmentEndpointWebExtension");
|
||||
then(extbeans.get("environmentEndpointWebExtension"))
|
||||
then(extbeans).hasSize(1).containsKey("writableEnvironmentEndpointWebExtension");
|
||||
then(extbeans.get("writableEnvironmentEndpointWebExtension"))
|
||||
.isInstanceOf(WritableEnvironmentEndpointWebExtension.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = ClientApp.class,
|
||||
properties = { "management.endpoints.web.exposure.include=*" },
|
||||
properties = { "management.endpoints.web.exposure.include=*",
|
||||
"management.endpoint.env.post.enabled=true" },
|
||||
webEnvironment = RANDOM_PORT)
|
||||
public class RefreshEndpointIntegrationTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user