Search in sources :

Example 41 with CheckResult

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

the class StackdriverSenderTest method verifyCheckReturnsFailureWhenServiceFailsForUnknownReason.

@Test
public void verifyCheckReturnsFailureWhenServiceFailsForUnknownReason() {
    onClientCall(observer -> {
        observer.onError(new RuntimeException("oh no"));
    });
    CheckResult result = sender.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error()).isInstanceOf(RuntimeException.class).hasMessageContaining("UNKNOWN");
}
Also used : StatusRuntimeException(io.grpc.StatusRuntimeException) CheckResult(zipkin2.CheckResult) Test(org.junit.Test)

Example 42 with CheckResult

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

the class StackdriverSpanConsumerTest method verifyCheckReturnsFailureWhenServiceFailsWithKnownGrpcFailure.

@Test
public void verifyCheckReturnsFailureWhenServiceFailsWithKnownGrpcFailure() {
    onClientCall(observer -> {
        observer.onError(new StatusRuntimeException(Status.RESOURCE_EXHAUSTED));
    });
    CheckResult result = storage.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error()).isInstanceOf(ArmeriaStatusException.class).satisfies(e -> assertThat(((ArmeriaStatusException) e).getCode()).isEqualTo(Status.RESOURCE_EXHAUSTED.getCode().value()));
}
Also used : CheckResult(zipkin2.CheckResult) StatusRuntimeException(io.grpc.StatusRuntimeException) ArmeriaStatusException(com.linecorp.armeria.common.grpc.protocol.ArmeriaStatusException) Test(org.junit.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