use of io.confluent.ksql.rest.entity.HealthCheckResponse in project ksql by confluentinc.
the class HealthCheckAgentTest method shouldReturnHealthyIfKafkaCheckFailsWithAuthorizationException.
@Test
public void shouldReturnHealthyIfKafkaCheckFailsWithAuthorizationException() {
// Given:
givenDescribeTopicsThrows(KsqlTopicAuthorizationException.class);
// When:
final HealthCheckResponse response = healthCheckAgent.checkHealth();
// Then:
assertThat(response.getDetails().get(KAFKA_CHECK_NAME).getIsHealthy(), is(true));
assertThat(response.getIsHealthy(), is(true));
}
use of io.confluent.ksql.rest.entity.HealthCheckResponse in project ksql by confluentinc.
the class HealthCheckAgentTest method shouldCheckHealth.
@Test
public void shouldCheckHealth() {
// When:
final HealthCheckResponse response = healthCheckAgent.checkHealth();
// Then:
verify(ksqlClient, atLeastOnce()).makeKsqlRequest(eq(SERVER_URI), any(), eq(REQUEST_PROPERTIES));
assertThat(response.getDetails().get(METASTORE_CHECK_NAME).getIsHealthy(), is(true));
assertThat(response.getDetails().get(KAFKA_CHECK_NAME).getIsHealthy(), is(true));
assertThat(response.getDetails().get(COMMAND_RUNNER_CHECK_NAME).getIsHealthy(), is(true));
assertThat(response.getIsHealthy(), is(true));
}
use of io.confluent.ksql.rest.entity.HealthCheckResponse in project ksql by confluentinc.
the class HealthCheckAgentTest method shouldReturnUnhealthyIfKafkaCheckFails.
@Test
public void shouldReturnUnhealthyIfKafkaCheckFails() {
// Given:
givenDescribeTopicsThrows(KafkaResponseGetFailedException.class);
// When:
final HealthCheckResponse response = healthCheckAgent.checkHealth();
// Then:
assertThat(response.getDetails().get(KAFKA_CHECK_NAME).getIsHealthy(), is(false));
assertThat(response.getIsHealthy(), is(false));
}
use of io.confluent.ksql.rest.entity.HealthCheckResponse in project ksql by confluentinc.
the class BackupRollbackIntegrationTest method isDegradedState.
private boolean isDegradedState() {
// If in degraded state, then the following command will return a warning
final List<KsqlEntity> response = makeKsqlRequest("Show Streams;");
final List<KsqlWarning> warnings = response.get(0).getWarnings();
final HealthCheckResponse res = RestIntegrationTestUtil.checkServerHealth(REST_APP);
return !res.getDetails().get(COMMAND_RUNNER_CHECK_NAME).getIsHealthy() && (warnings.size() > 0 && warnings.get(0).getMessage().contains(DefaultErrorMessages.COMMAND_RUNNER_DEGRADED_INCOMPATIBLE_COMMANDS_ERROR_MESSAGE));
}
use of io.confluent.ksql.rest.entity.HealthCheckResponse in project ksql by confluentinc.
the class HealthCheckAgentTest method shouldReturnUnhealthyIfMetastoreCheckFails.
@Test
public void shouldReturnUnhealthyIfMetastoreCheckFails() {
// Given:
when(ksqlClient.makeKsqlRequest(SERVER_URI, "list streams; list tables; list queries;", REQUEST_PROPERTIES)).thenReturn(unSuccessfulResponse);
// When:
final HealthCheckResponse response = healthCheckAgent.checkHealth();
// Then:
assertThat(response.getDetails().get(METASTORE_CHECK_NAME).getIsHealthy(), is(false));
assertThat(response.getIsHealthy(), is(false));
}
Aggregations