use of zipkin2.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 zipkin2.CheckResult in project zipkin-azure by openzipkin.
the class EventHubCollectorTest method check_failsOnRuntimeException_registration.
@Test
public void check_failsOnRuntimeException_registration() {
RuntimeException exception = new RuntimeException();
EventHubCollector collector = new EventHubCollector(new LazyFuture() {
@Override
protected Future<?> compute() {
registration.completeExceptionally(exception);
return registration;
}
});
CheckResult result = collector.check();
assertThat(result.error()).isEqualTo(exception);
}
use of zipkin2.CheckResult in project zipkin-azure by openzipkin.
the class EventHubCollectorTest method check_failsOnRuntimeException_registering.
@Test
public void check_failsOnRuntimeException_registering() {
RuntimeException exception = new RuntimeException();
EventHubCollector collector = new EventHubCollector(new LazyFuture() {
@Override
protected Future<?> compute() {
throw exception;
}
});
CheckResult result = collector.check();
assertThat(result.error()).isEqualTo(exception);
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class ITElasticsearchHealthCheck method noneHealthy.
@Test
public void noneHealthy() {
server1Health.setHealthy(false);
server2Health.setHealthy(false);
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
assertThat(result.error()).isInstanceOf(EmptyEndpointGroupException.class);
}
}
use of zipkin2.CheckResult in project zipkin by openzipkin.
the class MySQLStorageTest method check_failsInsteadOfThrowing.
@Test
public void check_failsInsteadOfThrowing() throws SQLException {
DataSource dataSource = mock(DataSource.class);
when(dataSource.getConnection()).thenThrow(new SQLException("foo"));
CheckResult result = storage(dataSource).check();
assertThat(result.ok()).isFalse();
assertThat(result.error()).isInstanceOf(SQLException.class);
}
Aggregations