Skip to content

Commit d017bdb

Browse files
authored
Merge pull request #4 from nramc/feature/1_AddSpringActuator
[feat] #1 spring actuator added to monitor application health
2 parents 172c907 + a1756be commit d017bdb

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
<groupId>org.springframework.boot</groupId>
2727
<artifactId>spring-boot-starter-web</artifactId>
2828
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-actuator</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-webflux</artifactId>
36+
</dependency>
2937

3038
<dependency>
3139
<groupId>org.springframework.boot</groupId>

src/test/java/com/github/nramc/dev/journey/api/JourneyApiApplicationTests.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@
55
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.boot.test.context.SpringBootTest;
77
import org.springframework.context.ApplicationContext;
8+
import org.springframework.test.web.reactive.server.WebTestClient;
89

9-
@SpringBootTest
10+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
1011
class JourneyApiApplicationTests {
1112
@Autowired
1213
private ApplicationContext applicationContext;
14+
@Autowired
15+
private WebTestClient webTestClient;
1316

1417
@Test
1518
void contextLoads() {
1619
Assertions.assertNotNull(applicationContext);
1720
}
1821

22+
@Test
23+
void testHealthCheckEndpoint() {
24+
webTestClient.get().uri("/actuator/health").exchange()
25+
.expectStatus().isOk();
26+
}
27+
1928
}

0 commit comments

Comments
 (0)