Add tests to assert behaviour of actuator endpoints with context path
See gh-4401
This commit is contained in:
parent
77190f126a
commit
dd7d587ea8
|
|
@ -166,6 +166,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