Search in sources :

Example 31 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.CheckResult in project spring-boot by spring-projects.

the class ZipkinRestTemplateSenderTests method checkShouldNotRaiseException.

@Test
void checkShouldNotRaiseException() {
    this.mockServer.expect(requestTo(ZIPKIN_URL)).andExpect(method(HttpMethod.POST)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
    CheckResult result = this.sut.check();
    assertThat(result.ok()).isFalse();
    assertThat(result.error()).hasMessageContaining("500 Internal Server Error");
}
Also used : CheckResult(zipkin2.CheckResult) Test(org.junit.jupiter.api.Test)

Example 32 with CheckResult

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

the class RabbitMQCollector method check.

@Override
public CheckResult check() {
    try {
        start();
        CheckResult failure = connection.failure.get();
        if (failure != null)
            return failure;
        return CheckResult.OK;
    } catch (Throwable e) {
        Call.propagateIfFatal(e);
        return CheckResult.failed(e);
    }
}
Also used : CheckResult(zipkin2.CheckResult)

Example 33 with CheckResult

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

the class ScribeCollectorTest method check_failsWhenNotStarted.

@Test
void check_failsWhenNotStarted() {
    try (ScribeCollector scribe = ScribeCollector.newBuilder().storage(storage).port(0).build()) {
        CheckResult result = scribe.check();
        assertThat(result.ok()).isFalse();
        assertThat(result.error()).isInstanceOf(IllegalStateException.class);
        scribe.start();
        assertThat(scribe.check().ok()).isTrue();
    }
}
Also used : CheckResult(zipkin2.CheckResult) Test(org.junit.jupiter.api.Test)

Example 34 with CheckResult

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

the class KafkaCollector method check.

@Override
public CheckResult check() {
    try {
        // check the kafka workers didn't quit
        CheckResult failure = kafkaWorkers.failure.get();
        if (failure != null)
            return failure;
        KafkaFuture<String> maybeClusterId = getAdminClient().describeCluster().clusterId();
        maybeClusterId.get(1, TimeUnit.SECONDS);
        return CheckResult.OK;
    } catch (Throwable e) {
        Call.propagateIfFatal(e);
        return CheckResult.failed(e);
    }
}
Also used : CheckResult(zipkin2.CheckResult)

Example 35 with CheckResult

use of com.sequenceiq.cloudbreak.core.flow2.CheckResult 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

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