@Test void checkShouldDetectWhenCassandraRecovered(DockerCassandraExtension.DockerCassandra cassandraServer) { try { cassandraServer.getContainer().pause(); healthCheck.check().block(); } finally { cassandraServer.getContainer().unpause(); } Result check = healthCheck.check().block(); assertThat(check.isHealthy()).isTrue(); }
@Override public Mono<Result> check() { return queryExecutor.execute(new SimpleStatement(SAMPLE_QUERY)) .map(resultSet -> Result.healthy(COMPONENT_NAME)) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Error checking Cassandra backend", e))); }
CassandraHealthCheck implements HealthCheck { @Override public Mono<Result> check() { return queryExecutor.execute(new SimpleStatement(SAMPLE_QUERY)) .map(resultSet -> Result.healthy(COMPONENT_NAME)) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Error checking Cassandra backend", e))); } }
CassandraHealthCheck implements HealthCheck { @Override public Mono<Result> check() { return queryExecutor.execute(new SimpleStatement(SAMPLE_QUERY)) .map(resultSet -> Result.healthy(COMPONENT_NAME)) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Error checking Cassandra backend", e))); } @Inject  CassandraHealthCheck(Session session); }
CassandraHealthCheck implements HealthCheck { @Override public Mono<Result> check() { return queryExecutor.execute(new SimpleStatement(SAMPLE_QUERY)) .map(resultSet -> Result.healthy(COMPONENT_NAME)) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Error checking Cassandra backend", e))); } @Inject  CassandraHealthCheck(Session session); @Override ComponentName componentName(); @Override Mono<Result> check(); }
CassandraHealthCheck implements HealthCheck { @Override public Mono<Result> check() { return queryExecutor.execute(new SimpleStatement(SAMPLE_QUERY)) .map(resultSet -> Result.healthy(COMPONENT_NAME)) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Error checking Cassandra backend", e))); } @Inject  CassandraHealthCheck(Session session); @Override ComponentName componentName(); @Override Mono<Result> check();  }