Skip to content

Commit ecac225

Browse files
committed
test: add test for health endpoint #28
1 parent 617b06f commit ecac225

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

backend/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ logging.level.org.flywaydb.core=warn
88

99
springdoc.api-docs.enabled=false
1010

11-
management.endpoint.health.show-details=always
11+
management.endpoint.health.show-details=when_authorized
1212
management.endpoint.health.probes.enabled=true

backend/src/test/java/ch/puzzle/pcts/ApplicationAvailabilityTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ static void configureProperties(DynamicPropertyRegistry registry) {
3434
registry.add("spring.datasource.password", postgres::getPassword);
3535
}
3636

37+
@DisplayName("Should be healthy")
38+
@Test
39+
void shouldBeHealthy() throws Exception {
40+
mvc
41+
.perform(get(BASEURL))
42+
.andExpect(status().isOk())
43+
.andExpect(jsonPath("$.status").value("UP"))
44+
.andExpect(content().string("{\"status\":\"UP\",\"groups\":[\"liveness\",\"readiness\"]}"));
45+
}
46+
3747
@DisplayName("Should accept traffic")
3848
@Test
3949
void shouldAcceptTraffic() throws Exception {

0 commit comments

Comments
 (0)