Property detect Health web extension with management context

Previously, the Health web extension was defined in the management
context and, as a result, it wasn't found when a separate port was
required. The side effect is that anything that the health web extension
does was not active anymore in that case.

This commit makes sure that the extension is always defined as part of
the main context where operations are discovered and merged.

Closes gh-11285
This commit is contained in:
Stephane Nicoll
2017-12-13 17:47:18 +01:00
parent 1fdc1e373c
commit 681fdb1ee8
11 changed files with 97 additions and 35 deletions

View File

@@ -75,7 +75,7 @@ public class ManagementPortAndPathSampleActuatorApplicationTests {
.getForEntity("http://localhost:" + this.managementPort + "/admin/health",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
}
@Test

View File

@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
"management.server.port=0" })
"management.server.port=0", "management.endpoint.health.show-details=true" })
public class ManagementPortSampleActuatorApplicationTests {
@LocalServerPort
@@ -77,6 +77,8 @@ public class ManagementPortSampleActuatorApplicationTests {
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
assertThat(entity.getBody()).contains("\"example\"");
assertThat(entity.getBody()).contains("\"counter\":42");
}
@Test