use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class CassandraDriverHealthIndicatorTests method healthWithOneUnknownNodeShouldReturnDown.
@Test
void healthWithOneUnknownNodeShouldReturnDown() {
CqlSession session = mockCqlSessionWithNodeState(NodeState.UNKNOWN);
CassandraDriverHealthIndicator healthIndicator = new CassandraDriverHealthIndicator(session);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class Neo4jHealthIndicatorTests method neo4jIsDown.
@Test
void neo4jIsDown() {
Driver driver = mock(Driver.class);
given(driver.session(any(SessionConfig.class))).willThrow(ServiceUnavailableException.class);
Health health = new Neo4jHealthIndicator(driver).health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails()).containsKeys("error");
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class Neo4jHealthIndicatorTests method neo4jIsUp.
@Test
void neo4jIsUp() {
ResultSummary resultSummary = ResultSummaryMock.createResultSummary("My Home", "test");
Driver driver = mockDriver(resultSummary, "4711", "ultimate collectors edition");
Health health = new Neo4jHealthIndicator(driver).health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails()).containsEntry("server", "4711@My Home");
assertThat(health.getDetails()).containsEntry("database", "test");
assertThat(health.getDetails()).containsEntry("edition", "ultimate collectors edition");
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class RedisHealthIndicatorTests method healthWhenClusterStateIsAbsentShouldBeUp.
@Test
void healthWhenClusterStateIsAbsentShouldBeUp() {
RedisConnectionFactory redisConnectionFactory = createClusterConnectionFactory(null);
RedisHealthIndicator healthIndicator = new RedisHealthIndicator(redisConnectionFactory);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().get("cluster_size")).isEqualTo(4L);
assertThat(health.getDetails().get("slots_up")).isEqualTo(4L);
assertThat(health.getDetails().get("slots_fail")).isEqualTo(0L);
then(redisConnectionFactory).should(atLeastOnce()).getConnection();
}
use of org.springframework.boot.actuate.health.Health in project spring-boot by spring-projects.
the class RedisHealthIndicatorTests method healthWhenClusterStateIsFailShouldBeDown.
@Test
void healthWhenClusterStateIsFailShouldBeDown() {
RedisConnectionFactory redisConnectionFactory = createClusterConnectionFactory("fail");
RedisHealthIndicator healthIndicator = new RedisHealthIndicator(redisConnectionFactory);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails().get("cluster_size")).isEqualTo(4L);
assertThat(health.getDetails().get("slots_up")).isEqualTo(3L);
assertThat(health.getDetails().get("slots_fail")).isEqualTo(1L);
then(redisConnectionFactory).should(atLeastOnce()).getConnection();
}
Aggregations