Search in sources :

Example 1 with HttpWaitStrategy

use of org.testcontainers.containers.wait.HttpWaitStrategy in project zipkin by openzipkin.

the class LazyElasticsearchHttpStorage method compute.

@Override
protected ElasticsearchHttpStorage compute() {
    try {
        container = new GenericContainer(image).withExposedPorts(9200).waitingFor(new HttpWaitStrategy().forPath("/"));
        container.start();
        System.out.println("Will use TestContainers Elasticsearch instance");
    } catch (Exception e) {
    // Ignore
    }
    ElasticsearchHttpStorage result = computeStorageBuilder().build();
    Component.CheckResult check = result.check();
    if (check.ok) {
        return result;
    } else {
        throw new AssumptionViolatedException(check.exception.getMessage(), check.exception);
    }
}
Also used : AssumptionViolatedException(org.junit.AssumptionViolatedException) HttpWaitStrategy(org.testcontainers.containers.wait.HttpWaitStrategy) ElasticsearchHttpStorage(zipkin.storage.elasticsearch.http.ElasticsearchHttpStorage) GenericContainer(org.testcontainers.containers.GenericContainer) Component(zipkin.Component) AssumptionViolatedException(org.junit.AssumptionViolatedException)

Example 2 with HttpWaitStrategy

use of org.testcontainers.containers.wait.HttpWaitStrategy in project zipkin by openzipkin.

the class LazyElasticsearchTransportStorage method compute.

@Override
protected ElasticsearchStorage compute() {
    try {
        container = new GenericContainer(image).withExposedPorts(9200, 9300).waitingFor(new HttpWaitStrategy().forPath("/"));
        container.start();
        System.out.println("Will use TestContainers Elasticsearch instance");
    } catch (Exception e) {
    // Ignore
    }
    ElasticsearchStorage result = computeStorageBuilder().build();
    Component.CheckResult check = result.check();
    if (check.ok) {
        return result;
    } else {
        throw new AssumptionViolatedException(check.exception.getMessage(), check.exception);
    }
}
Also used : AssumptionViolatedException(org.junit.AssumptionViolatedException) HttpWaitStrategy(org.testcontainers.containers.wait.HttpWaitStrategy) GenericContainer(org.testcontainers.containers.GenericContainer) Component(zipkin.Component) AssumptionViolatedException(org.junit.AssumptionViolatedException) IOException(java.io.IOException)

Example 3 with HttpWaitStrategy

use of org.testcontainers.containers.wait.HttpWaitStrategy in project zipkin by openzipkin.

the class LazyElasticsearchHttpStorage method compute.

@Override
protected ElasticsearchStorage compute() {
    try {
        container = new GenericContainer(image).withExposedPorts(9200).waitingFor(new HttpWaitStrategy().forPath("/"));
        container.start();
        System.out.println("Will use TestContainers Elasticsearch instance");
    } catch (Exception e) {
    // Ignore
    }
    ElasticsearchStorage result = computeStorageBuilder().build();
    Component.CheckResult check = result.check();
    if (check.ok) {
        return result;
    } else {
        throw new AssumptionViolatedException(check.exception.getMessage(), check.exception);
    }
}
Also used : AssumptionViolatedException(org.junit.AssumptionViolatedException) HttpWaitStrategy(org.testcontainers.containers.wait.HttpWaitStrategy) GenericContainer(org.testcontainers.containers.GenericContainer) Component(zipkin.Component) AssumptionViolatedException(org.junit.AssumptionViolatedException) IOException(java.io.IOException)

Aggregations

AssumptionViolatedException (org.junit.AssumptionViolatedException)3 GenericContainer (org.testcontainers.containers.GenericContainer)3 HttpWaitStrategy (org.testcontainers.containers.wait.HttpWaitStrategy)3 Component (zipkin.Component)3 IOException (java.io.IOException)2 ElasticsearchHttpStorage (zipkin.storage.elasticsearch.http.ElasticsearchHttpStorage)1