mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Add tests to assert behaviour of actuator endpoints with context path
See gh-4401
This commit is contained in:
parent
ae13082e0d
commit
7d04ca1e1b
@ -158,6 +158,36 @@ public class EndpointWebMvcAutoConfigurationTests {
|
||||
assertAllClosed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDifferentPortAndContext() throws Exception {
|
||||
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
|
||||
DifferentPortConfig.class, BaseConfiguration.class,
|
||||
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.applicationContext,
|
||||
"management.context-path=/admin");
|
||||
this.applicationContext.refresh();
|
||||
assertContent("/controller", ports.get().server, "controlleroutput");
|
||||
assertContent("/admin/endpoint", ports.get().management, "endpointoutput");
|
||||
assertContent("/admin/error", ports.get().management, startsWith("{"));
|
||||
this.applicationContext.close();
|
||||
assertAllClosed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDifferentPortAndMainContext() throws Exception {
|
||||
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
|
||||
DifferentPortConfig.class, BaseConfiguration.class,
|
||||
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.applicationContext,
|
||||
"management.context-path=/admin", "server.context-path=/spring");
|
||||
this.applicationContext.refresh();
|
||||
assertContent("/spring/controller", ports.get().server, "controlleroutput");
|
||||
assertContent("/admin/endpoint", ports.get().management, "endpointoutput");
|
||||
assertContent("/admin/error", ports.get().management, startsWith("{"));
|
||||
this.applicationContext.close();
|
||||
assertAllClosed();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onDifferentPortWithoutErrorMvcAutoConfiguration() throws Exception {
|
||||
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
|
||||
|
Loading…
Reference in New Issue
Block a user