Search in sources :

Example 1 with ArmeriaStatusException

use of com.linecorp.armeria.common.grpc.protocol.ArmeriaStatusException in project zipkin-gcp by openzipkin.

the class StackdriverSpanConsumerTest method verifyCheckReturnsFailureWhenServiceFailsForUnknownReason.

@Test
public void verifyCheckReturnsFailureWhenServiceFailsForUnknownReason() {
    onClientCall(observer -> {
        observer.onError(new RuntimeException("oh no"));
    });
    CheckResult result = storage.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error()).isInstanceOf(ArmeriaStatusException.class).satisfies(e -> assertThat(((ArmeriaStatusException) e).getCode()).isEqualTo(Status.UNKNOWN.getCode().value()));
}
Also used : StatusRuntimeException(io.grpc.StatusRuntimeException) CheckResult(zipkin2.CheckResult) ArmeriaStatusException(com.linecorp.armeria.common.grpc.protocol.ArmeriaStatusException) Test(org.junit.Test)

Example 2 with ArmeriaStatusException

use of com.linecorp.armeria.common.grpc.protocol.ArmeriaStatusException 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

ArmeriaStatusException (com.linecorp.armeria.common.grpc.protocol.ArmeriaStatusException)2 StatusRuntimeException (io.grpc.StatusRuntimeException)2 Test (org.junit.Test)2 CheckResult (zipkin2.CheckResult)2