use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class MySQLExtension method beforeAll.
@Override
public void beforeAll(ExtensionContext context) throws Exception {
if (context.getRequiredTestClass().getEnclosingClass() != null) {
// Only run once in outermost scope.
return;
}
container.start();
LOGGER.info("Using hostPort " + host() + ":" + port());
try (MySQLStorage result = computeStorageBuilder().build()) {
CheckResult check = result.check();
assumeTrue(check.ok(), () -> "Could not connect to storage, skipping test: " + check.error().getMessage());
dropAndRecreateSchema(result.datasource);
}
}
use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ForwardingStorageComponentTest method delegatesCheck.
@Test
public void delegatesCheck() {
CheckResult down = CheckResult.failed(new RuntimeException("failed"));
when(delegate.check()).thenReturn(down);
assertThat(forwarder.check()).isEqualTo(down);
verify(delegate).check();
}
use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.
the class ComponentHealth method ofComponent.
static ComponentHealth ofComponent(Component component) {
Throwable t = null;
try {
CheckResult check = component.check();
if (!check.ok())
t = check.error();
} catch (Throwable unexpected) {
Call.propagateIfFatal(unexpected);
t = unexpected;
}
if (t == null)
return new ComponentHealth(component.toString(), STATUS_UP, null);
String message = t.getMessage();
String error = t.getClass().getName() + (message != null ? ": " + message : "");
return new ComponentHealth(component.toString(), STATUS_DOWN, error);
}
use of com.sequenceiq.cloudbreak.core.flow2.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 com.sequenceiq.cloudbreak.core.flow2.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);
}
}
Aggregations