Search in sources :

Example 11 with CheckResult

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);
    }
}
Also used : CheckResult(zipkin2.CheckResult)

Example 12 with CheckResult

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);
}
Also used : CheckResult(zipkin2.CheckResult) Future(java.util.concurrent.Future) CompletableFuture(java.util.concurrent.CompletableFuture) Test(org.junit.Test)

Example 13 with CheckResult

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);
}
Also used : CheckResult(zipkin2.CheckResult) Future(java.util.concurrent.Future) CompletableFuture(java.util.concurrent.CompletableFuture) Test(org.junit.Test)

Example 14 with CheckResult

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);
    }
}
Also used : ElasticsearchStorage(zipkin2.elasticsearch.ElasticsearchStorage) CheckResult(zipkin2.CheckResult) Test(org.junit.Test)

Example 15 with CheckResult

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);
}
Also used : SQLException(java.sql.SQLException) CheckResult(zipkin2.CheckResult) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Aggregations

CheckResult (zipkin2.CheckResult)22 Test (org.junit.Test)12 Test (org.junit.jupiter.api.Test)5 ElasticsearchStorage (zipkin2.elasticsearch.ElasticsearchStorage)4 CompletableFuture (java.util.concurrent.CompletableFuture)2 Future (java.util.concurrent.Future)2 Component (zipkin2.Component)2 AggregatedHttpRequest (com.linecorp.armeria.common.AggregatedHttpRequest)1 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 SQLException (java.sql.SQLException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 DataSource (javax.sql.DataSource)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 Span (zipkin2.Span)1 QueryRequest (zipkin2.storage.QueryRequest)1