use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class CassandraDriverReactiveHealthIndicatorTests method healthWithOneHealthyNodeAndOneUnknownNodeShouldReturnUp.
@Test
void healthWithOneHealthyNodeAndOneUnknownNodeShouldReturnUp() {
CqlSession session = mockCqlSessionWithNodeState(NodeState.UP, NodeState.UNKNOWN);
CassandraDriverReactiveHealthIndicator healthIndicator = new CassandraDriverReactiveHealthIndicator(session);
Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.UP)).verifyComplete();
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class CassandraDriverReactiveHealthIndicatorTests method healthWithOneUnhealthyNodeShouldReturnDown.
@Test
void healthWithOneUnhealthyNodeShouldReturnDown() {
CqlSession session = mockCqlSessionWithNodeState(NodeState.DOWN);
CassandraDriverReactiveHealthIndicator healthIndicator = new CassandraDriverReactiveHealthIndicator(session);
Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)).verifyComplete();
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class CassandraDriverReactiveHealthIndicatorTests method healthWithOneForcedDownNodeShouldReturnDown.
@Test
void healthWithOneForcedDownNodeShouldReturnDown() {
CqlSession session = mockCqlSessionWithNodeState(NodeState.FORCED_DOWN);
CassandraDriverReactiveHealthIndicator healthIndicator = new CassandraDriverReactiveHealthIndicator(session);
Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)).verifyComplete();
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class CassandraDriverReactiveHealthIndicatorTests method healthWithOneUnknownNodeShouldReturnDown.
@Test
void healthWithOneUnknownNodeShouldReturnDown() {
CqlSession session = mockCqlSessionWithNodeState(NodeState.UNKNOWN);
CassandraDriverReactiveHealthIndicator healthIndicator = new CassandraDriverReactiveHealthIndicator(session);
Mono<Health> health = healthIndicator.health();
StepVerifier.create(health).consumeNextWith((h) -> assertThat(h.getStatus()).isEqualTo(Status.DOWN)).verifyComplete();
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class RedisHealthIndicatorTests method redisIsDown.
@Test
void redisIsDown() {
RedisConnection redisConnection = mock(RedisConnection.class);
given(redisConnection.info("server")).willThrow(new RedisConnectionFailureException("Connection failed"));
RedisHealthIndicator healthIndicator = createHealthIndicator(redisConnection);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat((String) health.getDetails().get("error")).contains("Connection failed");
}
Aggregations