use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ITElasticsearchClientInitialization method doesntHangWhenAllDown.
/**
* blocking a little is ok, but blocking forever is not.
*/
@Test(timeout = 3000L)
public void doesntHangWhenAllDown() throws IOException {
TestPropertyValues.of("spring.config.name=zipkin-server", "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.timeout:1000", "zipkin.storage.elasticsearch.hosts:127.0.0.1:1234,127.0.0.1:5678").applyTo(context);
Access.registerElasticsearch(context);
context.refresh();
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
}
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method wrongScheme.
@Test
public void wrongScheme() {
context.close();
context = new AnnotationConfigApplicationContext();
initWithHosts("https://localhost:" + server1.httpPort());
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
// Test this is not wrapped in a rejection exception, as health check is not throttled
// Depending on JDK this is SSLHandshakeException or NotSslRecordException
assertThat(result.error()).isInstanceOf(SSLException.class);
}
}
use of zipkin2.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 zipkin2.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 zipkin2.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");
}
Aggregations