Search in sources :

Example 6 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.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());
    }
}
Also used : ElasticsearchStorage(zipkin2.elasticsearch.ElasticsearchStorage) CheckResult(zipkin2.CheckResult) Test(org.junit.Test)

Example 7 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.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");
}
Also used : CheckResult(zipkin2.CheckResult) IOException(java.io.IOException) Component(zipkin2.Component) Test(org.junit.Test)

Example 8 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.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");
}
Also used : CheckResult(zipkin2.CheckResult) Component(zipkin2.Component) Test(org.junit.Test)

Example 9 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.

the class ElasticsearchStorageTest method check_ensuresIndexTemplates_fail_onNoContent.

// makes sure we don't NPE
@Test
void check_ensuresIndexTemplates_fail_onNoContent() {
    // empty instead of version json
    server.enqueue(SUCCESS_RESPONSE);
    CheckResult result = storage.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error().getMessage()).isEqualTo("No content reading Elasticsearch version");
}
Also used : CheckResult(zipkin2.CheckResult) Test(org.junit.jupiter.api.Test)

Example 10 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project zipkin by openzipkin.

the class ITEnsureSchema method worksWithOldSchema.

/**
 * This tests we don't accidentally rely on new indexes such as autocomplete tags
 */
@Test
void worksWithOldSchema(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema.cql");
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema-indexes-original.cql");
    // Ensure the storage component is functional before proceeding
    CheckResult check = storage.check();
    if (!check.ok()) {
        throw new AssertionError("Could not connect to storage: " + check.error().getMessage(), check.error());
    }
    List<Span> trace = newTrace(testSuffix);
    accept(trace);
    assertGetTraceReturns(trace.get(0).traceId(), trace);
    assertThat(storage.autocompleteTags().getValues("environment").execute()).isEmpty();
    String serviceName = trace.get(0).localServiceName();
    assertThat(storage.serviceAndSpanNames().getRemoteServiceNames(serviceName).execute()).isEmpty();
    QueryRequest request = requestBuilder().serviceName(serviceName).remoteServiceName(appendSuffix(BACKEND.serviceName(), testSuffix)).build();
    // Make sure there's an error if a query will return incorrectly vs returning invalid results
    assertThatThrownBy(() -> storage.spanStore().getTraces(request)).isInstanceOf(IllegalArgumentException.class).hasMessage("remoteService=" + trace.get(1).remoteServiceName() + " unsupported due to missing table remote_service_by_service");
}
Also used : QueryRequest(zipkin2.storage.QueryRequest) CheckResult(zipkin2.CheckResult) Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Aggregations

CheckResult (zipkin2.CheckResult)30 Test (org.junit.Test)24 CheckResult (com.sequenceiq.cloudbreak.core.flow2.CheckResult)12 Test (org.junit.jupiter.api.Test)7 StatedImage (com.sequenceiq.cloudbreak.service.image.StatedImage)6 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)5 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)4 Json (com.sequenceiq.cloudbreak.common.json.Json)4 Package (com.sequenceiq.cloudbreak.service.cluster.Package)4 StatusRuntimeException (io.grpc.StatusRuntimeException)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 ElasticsearchStorage (zipkin2.elasticsearch.ElasticsearchStorage)4 Bean (org.springframework.context.annotation.Bean)3 Span (zipkin2.Span)3 ArmeriaStatusException (com.linecorp.armeria.common.grpc.protocol.ArmeriaStatusException)2 Image (com.sequenceiq.cloudbreak.cloud.model.Image)2 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)2 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Future (java.util.concurrent.Future)2