Search in sources :

Example 11 with CheckResult

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

the class RabbitMQCollectorTest method checkFalseWhenRabbitMQIsDown.

@Test
public void checkFalseWhenRabbitMQIsDown() {
    CheckResult check = collector.check();
    assertThat(check.ok()).isFalse();
    assertThat(check.error()).isInstanceOf(UncheckedIOException.class);
}
Also used : CheckResult(zipkin2.CheckResult) Test(org.junit.Test)

Example 12 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.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 com.sequenceiq.cloudbreak.core.flow2.CheckResult in project spring-cloud-gcp by spring-cloud.

the class StackdriverTraceAutoConfiguration method stackdriverReporter.

@Bean(REPORTER_BEAN_NAME)
@ConditionalOnMissingBean(name = REPORTER_BEAN_NAME)
public Reporter<Span> stackdriverReporter(ReporterMetrics reporterMetrics, GcpTraceProperties trace, @Qualifier(SENDER_BEAN_NAME) Sender sender) {
    AsyncReporter<Span> asyncReporter = AsyncReporter.builder(sender).queuedMaxSpans(1000).messageTimeout(trace.getMessageTimeout(), TimeUnit.SECONDS).metrics(reporterMetrics).build(StackdriverEncoder.V2);
    CheckResult checkResult = asyncReporter.check();
    if (!checkResult.ok()) {
        LOGGER.warn("Error when performing Stackdriver AsyncReporter health check.", checkResult.error());
    }
    return asyncReporter;
}
Also used : CheckResult(zipkin2.CheckResult) Span(zipkin2.Span) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 14 with CheckResult

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

the class ITStackdriverSender method healthcheckFailNoPermission.

@Test
public void healthcheckFailNoPermission() {
    CheckResult result = reporterNoPermission.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error()).isNotNull();
    assertThat(result.error()).isInstanceOfSatisfying(StatusRuntimeException.class, sre -> assertThat(sre.getStatus().getCode()).isEqualTo(Status.Code.PERMISSION_DENIED));
}
Also used : CheckResult(zipkin2.CheckResult) Test(org.junit.jupiter.api.Test)

Example 15 with CheckResult

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

the class StackdriverSenderTest method verifyCheckReturnsFailureWhenServiceFailsWithKnownGrpcFailure.

@Test
public void verifyCheckReturnsFailureWhenServiceFailsWithKnownGrpcFailure() {
    onClientCall(observer -> {
        observer.onError(new StatusRuntimeException(Status.RESOURCE_EXHAUSTED));
    });
    CheckResult result = sender.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error()).isInstanceOf(StatusRuntimeException.class).hasMessageContaining("RESOURCE_EXHAUSTED");
}
Also used : CheckResult(zipkin2.CheckResult) StatusRuntimeException(io.grpc.StatusRuntimeException) 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