use of org.testcontainers.containers.GenericContainer 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);
}
}
use of org.testcontainers.containers.GenericContainer 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);
}
}
use of org.testcontainers.containers.GenericContainer 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);
}
}
use of org.testcontainers.containers.GenericContainer in project testcontainers-java by testcontainers.
the class DockerfileTest method verifyImage.
protected void verifyImage(ImageFromDockerfile image) {
GenericContainer container = new GenericContainer(image);
try {
container.start();
pass("Should start from Dockerfile");
} finally {
container.stop();
}
}
use of org.testcontainers.containers.GenericContainer in project testcontainers-java by testcontainers.
the class GenericContainerRuleTest method createContainerCmdHookTest.
@Test
public void createContainerCmdHookTest() {
// Use random name to avoid the conflicts between the tests
String randomName = Base58.randomString(5);
try (GenericContainer container = new GenericContainer<>("redis:3.0.2").withCommand("redis-server", "--help").withCreateContainerCmdModifier(cmd -> cmd.withName("overrideMe")).withCreateContainerCmdModifier(cmd -> cmd.withName(randomName)).withCreateContainerCmdModifier(cmd -> cmd.withCmd("redis-server", "--port", "6379"))) {
container.start();
assertEquals("Name is configured", "/" + randomName, container.getContainerInfo().getName());
assertEquals("Command is configured", "[redis-server, --port, 6379]", Arrays.toString(container.getContainerInfo().getConfig().getCmd()));
}
}
Aggregations