How do you access LocalManagementPort with DCR?
jibin-tj opened this issue · 2 comments
jibin-tj commented
I'm unable to access management port for health check.
Here is my docker-compose file:
version: '3'
services:
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: jibin
MYSQL_PASSWORD: jibin
MYSQL_ROOT_HOST: '%'
personalization-integrationtest-webapp:
image: personalization_1.0.0:latest
depends_on:
- db
ports:
- 8080:8080
- 8081:8081
This is my Test Class:
@LocalManagementPort
private int managementPort = 8081;
@Test
public void checkDbFromApp() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity =
this.restTemplate.getForEntity(
"http://localhost:" + this.managementPort + "/actuator/health",
Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
assertThat(body).containsKey("propertySources");
}
dotCipher commented
This seems like @LocalManagementPort
is a spring-boot thing right?
To better understand / help you here can you paste your DockerComposeRule
block (or wherever you declare and initialize your DockerComposeRule
?
dotCipher commented
Also whats the error / stacktrace that you are seeing?