use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method notHealthyThenHealthyThenNotHealthy.
@Test
public void notHealthyThenHealthyThenNotHealthy() {
server1Health.setHealthy(false);
server2Health.setHealthy(false);
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
server2Health.setHealthy(true);
awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isTrue());
server2Health.setHealthy(false);
awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isFalse());
}
}
use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ComponentHealthTest method addsMessageToDetails.
@Test
public void addsMessageToDetails() {
ComponentHealth health = ComponentHealth.ofComponent(new Component() {
@Override
public CheckResult check() {
return CheckResult.failed(new IOException("socket disconnect"));
}
});
assertThat(health.error).isEqualTo("java.io.IOException: socket disconnect");
}
use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ComponentHealthTest method doesntAddNullMessageToDetails.
@Test
public void doesntAddNullMessageToDetails() {
ComponentHealth health = ComponentHealth.ofComponent(new Component() {
@Override
public CheckResult check() {
return CheckResult.failed(ClosedSessionException.get());
}
});
assertThat(health.error).isEqualTo("com.linecorp.armeria.common.ClosedSessionException");
}
use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ElasticsearchStorageTest method check_ensuresIndexTemplates_fail_onNoContent.
// makes sure we don't NPE
@Test
void check_ensuresIndexTemplates_fail_onNoContent() {
// empty instead of version json
server.enqueue(SUCCESS_RESPONSE);
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
assertThat(result.error().getMessage()).isEqualTo("No content reading Elasticsearch version");
}
use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ITEnsureSchema method worksWithOldSchema.
/**
* This tests we don't accidentally rely on new indexes such as autocomplete tags
*/
@Test
void worksWithOldSchema(TestInfo testInfo) throws Exception {
String testSuffix = testSuffix(testInfo);
Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema.cql");
Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema-indexes-original.cql");
// Ensure the storage component is functional before proceeding
CheckResult check = storage.check();
if (!check.ok()) {
throw new AssertionError("Could not connect to storage: " + check.error().getMessage(), check.error());
}
List<Span> trace = newTrace(testSuffix);
accept(trace);
assertGetTraceReturns(trace.get(0).traceId(), trace);
assertThat(storage.autocompleteTags().getValues("environment").execute()).isEmpty();
String serviceName = trace.get(0).localServiceName();
assertThat(storage.serviceAndSpanNames().getRemoteServiceNames(serviceName).execute()).isEmpty();
QueryRequest request = requestBuilder().serviceName(serviceName).remoteServiceName(appendSuffix(BACKEND.serviceName(), testSuffix)).build();
// Make sure there's an error if a query will return incorrectly vs returning invalid results
assertThatThrownBy(() -> storage.spanStore().getTraces(request)).isInstanceOf(IllegalArgumentException.class).hasMessage("remoteService=" + trace.get(1).remoteServiceName() + " unsupported due to missing table remote_service_by_service");
}
Aggregations