Search in sources :

Example 6 with ElasticsearchStorage

use of zipkin2.elasticsearch.ElasticsearchStorage in project zipkin by openzipkin.

the class ITElasticsearchHealthCheck method healthyThenNotHealthyThenHealthy.

// If this flakes, uncomment in initWithHosts and log4j2.properties
@Test
public void healthyThenNotHealthyThenHealthy() {
    try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
        assertOk(storage.check());
        logger.info("setting server 1 and 2 unhealthy");
        server1Health.setHealthy(false);
        server2Health.setHealthy(false);
        awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isFalse());
        logger.info("setting server 1 healthy");
        server1Health.setHealthy(true);
        awaitTimeout.untilAsserted(() -> assertThat(storage.check().ok()).isTrue());
    }
}
Also used : ElasticsearchStorage(zipkin2.elasticsearch.ElasticsearchStorage) Test(org.junit.Test)

Example 7 with ElasticsearchStorage

use of zipkin2.elasticsearch.ElasticsearchStorage 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)

Aggregations

Test (org.junit.Test)6 ElasticsearchStorage (zipkin2.elasticsearch.ElasticsearchStorage)6 CheckResult (zipkin2.CheckResult)4 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 DependencyLink (zipkin2.DependencyLink)1 BulkCallBuilder (zipkin2.elasticsearch.internal.BulkCallBuilder)1