org.testcontainers.utility.TestcontainersConfiguration Java Examples

The following examples show how to use org.testcontainers.utility.TestcontainersConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConsulTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer(CONTAINER_IMAGE)
                .withExposedPorts(CONTAINER_PORT)
                .withCommand("agent", "-dev", "-server", "-bootstrap", "-client", "0.0.0.0", "-log-level", "trace")
                .waitingFor(Wait.forLogMessage(".*Synced node info.*", 1));

        container.start();

        return CollectionHelper.mapOf(
                "camel.consul.test-url",
                String.format("http://%s:%d",
                        container.getContainerIpAddress(),
                        container.getMappedPort(CONTAINER_PORT)));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #2
Source File: ReusabilityUnitTests.java    From testcontainers-java with MIT License 6 votes vote down vote up
@Test
public void shouldSetCopiedFilesHashLabel() {
    Mockito.doReturn(true).when(TestcontainersConfiguration.getInstance()).environmentSupportsReuse();
    AtomicReference<CreateContainerCmd> commandRef = new AtomicReference<>();
    String containerId = randomContainerId();
    when(client.createContainerCmd(any())).then(createContainerAnswer(containerId, commandRef::set));
    when(client.listContainersCmd()).then(listContainersAnswer());
    when(client.startContainerCmd(containerId)).then(startContainerAnswer());
    when(client.inspectContainerCmd(containerId)).then(inspectContainerAnswer());

    container.start();

    assertThat(commandRef).isNotNull();
    assertThat(commandRef.get().getLabels())
        .containsKeys(GenericContainer.COPIED_FILES_HASH_LABEL);
}
 
Example #3
Source File: KafkaContainer.java    From testcontainers-java with MIT License 6 votes vote down vote up
public KafkaContainer(String confluentPlatformVersion) {
    super(TestcontainersConfiguration.getInstance().getKafkaImage() + ":" + confluentPlatformVersion);

    withExposedPorts(KAFKA_PORT);

    // Use two listeners with different names, it will force Kafka to communicate with itself via internal
    // listener when KAFKA_INTER_BROKER_LISTENER_NAME is set, otherwise Kafka will try to use the advertised listener
    withEnv("KAFKA_LISTENERS", "PLAINTEXT://0.0.0.0:" + KAFKA_PORT + ",BROKER://0.0.0.0:9092");
    withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "BROKER:PLAINTEXT,PLAINTEXT:PLAINTEXT");
    withEnv("KAFKA_INTER_BROKER_LISTENER_NAME", "BROKER");

    withEnv("KAFKA_BROKER_ID", "1");
    withEnv("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "1");
    withEnv("KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS", "1");
    withEnv("KAFKA_LOG_FLUSH_INTERVAL_MESSAGES", Long.MAX_VALUE + "");
    withEnv("KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS", "0");
}
 
Example #4
Source File: ReusabilityUnitTests.java    From testcontainers-java with MIT License 6 votes vote down vote up
@Test
public void shouldSetLabelsIfEnvironmentDoesNotSupportReuse() {
    Mockito.doReturn(false).when(TestcontainersConfiguration.getInstance()).environmentSupportsReuse();
    AtomicReference<CreateContainerCmd> commandRef = new AtomicReference<>();
    String containerId = randomContainerId();
    when(client.createContainerCmd(any())).then(createContainerAnswer(containerId, commandRef::set));
    when(client.startContainerCmd(containerId)).then(startContainerAnswer());
    when(client.inspectContainerCmd(containerId)).then(inspectContainerAnswer());

    container.start();

    assertThat(commandRef)
        .isNotNull()
        .satisfies(command -> {
            assertThat(command.get().getLabels())
                .containsKeys(DockerClientFactory.TESTCONTAINERS_SESSION_ID_LABEL);
        });
}
 
Example #5
Source File: CamelKafkaTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new KafkaContainer(CONFLUENT_PLATFORM_VERSION)
                .withEmbeddedZookeeper()
                .waitingFor(Wait.forListeningPort());

        container.start();

        return Collections.singletonMap("camel.component.kafka.brokers", container.getBootstrapServers());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #6
Source File: ElasticSearchTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer(ELASTICSEARCH_IMAGE)
                .withExposedPorts(ELASTICSEARCH_PORT)
                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
                .withEnv("discovery.type", "single-node")
                .waitingFor(Wait.forListeningPort());

        container.start();

        return CollectionHelper.mapOf(
                "camel.component.elasticsearch-rest.host-addresses",
                String.format("localhost:%s", container.getMappedPort(ELASTICSEARCH_PORT)));

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #7
Source File: TestRyukImage.java    From presto with Apache License 2.0 6 votes vote down vote up
@Test
public void testImageVersion()
        throws Exception
{
    String defaultRyukImage = getDefaultConfiguration().getRyukImage();
    assertThat(defaultRyukImage).doesNotContain("presto"); // sanity check defaults are indeed defaults
    assertThat(defaultRyukImage).startsWith("quay.io/testcontainers/ryuk"); // if the image is moved to e.g. Docker Hub, we may want to remove our override

    Matcher matcher = Pattern.compile(".*:(\\d\\.\\d\\.\\d)$").matcher(defaultRyukImage);
    assertTrue(matcher.matches());
    String version = matcher.group(1);

    String effectiveRyukImage = TestcontainersConfiguration.getInstance().getRyukImage();

    // Verify we are using our image (otherwise this test method is not needed).
    assertThat(effectiveRyukImage).startsWith("prestodev/");

    // Verify we have the same version
    assertThat(effectiveRyukImage).endsWith(":" + version);
}
 
Example #8
Source File: MongoDbTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer(MONGO_IMAGE)
                .withExposedPorts(MONGODB_PORT)
                .waitingFor(Wait.forListeningPort());

        container.start();

        return CollectionHelper.mapOf(
                "quarkus.mongodb.hosts",
                container.getContainerIpAddress() + ":" + container.getMappedPort(MONGODB_PORT).toString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #9
Source File: DockerClientProviderStrategy.java    From testcontainers-java with MIT License 6 votes vote down vote up
protected DockerClient getClientForConfig(DockerClientConfig config) {
    config = new AuthDelegatingDockerClientConfig(config);
    final DockerHttpClient dockerHttpClient;

    String transportType = TestcontainersConfiguration.getInstance().getTransportType();
    switch (transportType) {
        case "okhttp":
            dockerHttpClient = new OkDockerHttpClient.Builder()
                .dockerHost(config.getDockerHost())
                .sslConfig(config.getSSLConfig())
                .build();
            break;
        case "httpclient5":
            dockerHttpClient = new ZerodepDockerHttpClient.Builder()
                .dockerHost(config.getDockerHost())
                .sslConfig(config.getSSLConfig())
                .build();
            break;
        default:
            throw new IllegalArgumentException("Unknown transport type '" + transportType + "'");
    }

    return DockerClientImpl.getInstance(config, dockerHttpClient);
}
 
Example #10
Source File: ActiveMQTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer(ACTIVEMQ_IMAGE)
                .withExposedPorts(AMQP_PORT)
                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
                .withEnv("BROKER_CONFIG_MAX_DISK_USAGE", "100")
                .waitingFor(Wait.forListeningPort());

        container.start();

        String brokerUrl = String.format("amqp://127.0.0.1:%d", container.getMappedPort(AMQP_PORT));

        return CollectionHelper.mapOf(
                "quarkus.qpid-jms.url", brokerUrl,
                "quarkus.qpid-jms.username", ACTIVEMQ_USERNAME,
                "quarkus.qpid-jms.password", ACTIVEMQ_PASSWORD);

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #11
Source File: ActiveMQTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer<>(ACTIVEMQ_IMAGE)
                .withExposedPorts(TCP_PORT)
                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
                .waitingFor(Wait.forListeningPort());

        container.start();

        return Collections.singletonMap(
                "camel.component.activemq.broker-url",
                String.format("tcp://%s:%d", container.getContainerIpAddress(), container.getMappedPort(TCP_PORT)));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #12
Source File: InfinispanServerTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer<>(CONTAINER_IMAGE)
                .withExposedPorts(HOTROD_PORT)
                .withEnv("USER", USER)
                .withEnv("PASS", PASS)
                .waitingFor(Wait.forListeningPort());

        container.start();

        return CollectionHelper.mapOf(
                "quarkus.infinispan-client.server-list", getHostAndPort(container, HOTROD_PORT),
                "quarkus.infinispan-client.near-cache-max-entries", "3",
                "quarkus.infinispan-client.auth-username", USER,
                "quarkus.infinispan-client.auth-password", PASS,
                "quarkus.infinispan-client.auth-realm", "default",
                "quarkus.infinispan-client.sasl-mechanism", "DIGEST-MD5",
                "quarkus.infinispan-client.auth-server-name", "infinispan");
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #13
Source File: FhirTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer(CONTAINER_IMAGE)
                .withExposedPorts(CONTAINER_PORT)
                .withEnv("HAPI_FHIR_VERSION", "DSTU3")
                .waitingFor(Wait.forListeningPort());

        container.start();

        return CollectionHelper.mapOf(
                "camel.fhir.test-url",
                String.format(
                        "http://%s:%d/hapi-fhir-jpaserver/fhir",
                        container.getContainerIpAddress(),
                        container.getMappedPort(CONTAINER_PORT)));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #14
Source File: InfluxdbTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer<>(INFLUXDB_IMAGE)
                .withExposedPorts(INFLUXDB_PORT)
                .waitingFor(Wait.forListeningPort());

        container.start();

        return CollectionHelper.mapOf(
                InfluxdbResource.INFLUXDB_CONNECTION_PROPERTY,
                "http://" + ContainerSupport.getHostAndPort(container, INFLUXDB_PORT));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #15
Source File: AbstractDebeziumTestResource.java    From camel-quarkus with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());
    try {
        storeFile = Files.createTempFile(getClass().getSimpleName() + "-store-", "");

        container = createContainer();

        container.start();

        Map<String, String> map = CollectionHelper.mapOf(
                type.getPropertyHostname(), container.getContainerIpAddress(),
                type.getPropertyPort(), container.getMappedPort(getPort()) + "",
                type.getPropertyUsername(), getUsername(),
                type.getPropertyPassword(), getPassword(),
                type.getPropertyOffsetFileName(), storeFile.toString(),
                type.getPropertyJdbc(), getJdbcUrl());

        return map;

    } catch (Exception e) {
        LOGGER.error("Container does not start", e);
        throw new RuntimeException(e);
    }
}
 
Example #16
Source File: ReusabilityUnitTests.java    From testcontainers-java with MIT License 6 votes vote down vote up
@Test
public void shouldSetLabelsIfEnvironmentDoesNotSupportReuse() {
    Mockito.doReturn(false).when(TestcontainersConfiguration.getInstance()).environmentSupportsReuse();

    String containerId = randomContainerId();
    when(client.createContainerCmd(any())).then(createContainerAnswer(containerId));
    when(client.listContainersCmd()).then(listContainersAnswer());
    when(client.startContainerCmd(containerId)).then(startContainerAnswer());
    when(client.inspectContainerCmd(containerId)).then(inspectContainerAnswer());

    container.start();
    assertThat(script).containsExactly(
        "containerIsCreated",
        "containerIsStarting(reused=false)",
        "containerIsStarted(reused=false)"
    );
}
 
Example #17
Source File: ReusabilityUnitTests.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
public void shouldReuseIfListReturnsID() {
    Mockito.doReturn(true).when(TestcontainersConfiguration.getInstance()).environmentSupportsReuse();
    String containerId = randomContainerId();
    when(client.createContainerCmd(any())).then(createContainerAnswer(containerId));
    String existingContainerId = randomContainerId();
    when(client.listContainersCmd()).then(listContainersAnswer(existingContainerId));
    when(client.inspectContainerCmd(existingContainerId)).then(inspectContainerAnswer());

    container.start();

    Mockito.verify(client, Mockito.never()).startContainerCmd(containerId);
    Mockito.verify(client, Mockito.never()).startContainerCmd(existingContainerId);
}
 
Example #18
Source File: DockerComposeContainer.java    From testcontainers-java with MIT License 5 votes vote down vote up
public ContainerisedDockerCompose(List<File> composeFiles, String identifier) {

        super(TestcontainersConfiguration.getInstance().getDockerComposeContainerImage());
        addEnv(ENV_PROJECT_NAME, identifier);

        // Map the docker compose file into the container
        final File dockerComposeBaseFile = composeFiles.get(0);
        final String pwd = dockerComposeBaseFile.getAbsoluteFile().getParentFile().getAbsolutePath();
        final String containerPwd = MountableFile.forHostPath(pwd).getFilesystemPath();

        final List<String> absoluteDockerComposeFiles = composeFiles.stream()
            .map(File::getAbsolutePath)
            .map(MountableFile::forHostPath)
            .map(MountableFile::getFilesystemPath)
            .collect(toList());
        final String composeFileEnvVariableValue = Joiner.on(UNIX_PATH_SEPERATOR).join(absoluteDockerComposeFiles); // we always need the UNIX path separator
        logger().debug("Set env COMPOSE_FILE={}", composeFileEnvVariableValue);
        addEnv(ENV_COMPOSE_FILE, composeFileEnvVariableValue);
        addFileSystemBind(pwd, containerPwd, READ_ONLY);

        // Ensure that compose can access docker. Since the container is assumed to be running on the same machine
        //  as the docker daemon, just mapping the docker control socket is OK.
        // As there seems to be a problem with mapping to the /var/run directory in certain environments (e.g. CircleCI)
        //  we map the socket file outside of /var/run, as just /docker.sock
        addFileSystemBind(getDockerSocketHostPath(), "/docker.sock", READ_WRITE);
        addEnv("DOCKER_HOST", "unix:///docker.sock");
        setStartupCheckStrategy(new IndefiniteWaitOneShotStartupCheckStrategy());
        setWorkingDirectory(containerPwd);
    }
 
Example #19
Source File: VncRecordingContainer.java    From testcontainers-java with MIT License 5 votes vote down vote up
/**
 * Create a sidekick container and attach it to another container. The VNC output of that container will be recorded.
 */
public VncRecordingContainer(@NonNull Network network, @NonNull String targetNetworkAlias) throws IllegalStateException {
    super(TestcontainersConfiguration.getInstance().getVncRecordedContainerImage());

    this.targetNetworkAlias = targetNetworkAlias;
    withNetwork(network);
    waitingFor(new LogMessageWaitStrategy()
        .withRegEx(".*Connected.*")
        .withStartupTimeout(Duration.of(15, SECONDS)));
}
 
Example #20
Source File: ReusabilityUnitTests.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
public void shouldCallHookIfReused() {
    Mockito.doReturn(true).when(TestcontainersConfiguration.getInstance()).environmentSupportsReuse();
    String containerId = randomContainerId();
    when(client.createContainerCmd(any())).then(createContainerAnswer(containerId));
    String existingContainerId = randomContainerId();
    when(client.listContainersCmd()).then(listContainersAnswer(existingContainerId));
    when(client.inspectContainerCmd(existingContainerId)).then(inspectContainerAnswer());

    container.start();
    assertThat(script).containsExactly(
        "containerIsStarting(reused=true)",
        "containerIsStarted(reused=true)"
    );
}
 
Example #21
Source File: OracleContainer.java    From testcontainers-java with MIT License 5 votes vote down vote up
private static String resolveImageName() {
    String image = TestcontainersConfiguration.getInstance()
        .getProperties().getProperty("oracle.container.image");

    if (image == null) {
        throw new IllegalStateException("An image to use for Oracle containers must be configured. " +
            "To do this, please place a file on the classpath named `testcontainers.properties`, " +
            "containing `oracle.container.image=IMAGE`, where IMAGE is a suitable image name and tag.");
    }
    return image;
}
 
Example #22
Source File: ReusabilityUnitTests.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
public void shouldHashCopiedFiles() {
    Mockito.doReturn(true).when(TestcontainersConfiguration.getInstance()).environmentSupportsReuse();
    AtomicReference<CreateContainerCmd> commandRef = new AtomicReference<>();
    String containerId = randomContainerId();
    when(client.createContainerCmd(any())).then(createContainerAnswer(containerId, commandRef::set));
    when(client.listContainersCmd()).then(listContainersAnswer());
    when(client.startContainerCmd(containerId)).then(startContainerAnswer());
    when(client.inspectContainerCmd(containerId)).then(inspectContainerAnswer());

    container.start();

    assertThat(commandRef).isNotNull();

    Map<String, String> labels = commandRef.get().getLabels();
    assertThat(labels).containsKeys(GenericContainer.COPIED_FILES_HASH_LABEL);

    String oldHash = labels.get(GenericContainer.COPIED_FILES_HASH_LABEL);

    // Simulate stop
    container.containerId = null;

    container.withCopyFileToContainer(
        MountableFile.forClasspathResource("test_copy_to_container.txt"),
        "/foo/bar"
    );
    container.start();

    assertThat(commandRef.get().getLabels()).hasEntrySatisfying(GenericContainer.COPIED_FILES_HASH_LABEL, newHash -> {
        assertThat(newHash).as("new hash").isNotEqualTo(oldHash);
    });
}
 
Example #23
Source File: DockerClientFactoryTest.java    From testcontainers-java with MIT License 5 votes vote down vote up
@Test
public void runCommandInsideDockerShouldNotFailIfImageDoesNotExistsLocally() {

    final DockerClientFactory dockFactory = DockerClientFactory.instance();
    try {
        //remove tiny image, so it will be pulled during next command run
        dockFactory.client()
                .removeImageCmd(TestcontainersConfiguration.getInstance().getTinyImage())
                .withForce(true).exec();
    } catch (NotFoundException ignored) {
        // Do not fail if it's not pulled yet
    }

    dockFactory.runInsideDocker(
            cmd -> cmd.withCmd("sh", "-c", "echo 'SUCCESS'"),
            (client, id) ->
                    client.logContainerCmd(id)
                            .withStdOut(true)
                            .exec(new LogToStringContainerCallback())
                            .toString()
    );
}
 
Example #24
Source File: ActiveMQTestResource.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer<>(ACTIVEMQ_IMAGE)
                .withExposedPorts(ACTIVEMQ_PORT)
                .withLogConsumer(new Slf4jLogConsumer(LOGGER))
                .withEnv("BROKER_CONFIG_MAX_DISK_USAGE", "100")
                .waitingFor(Wait.forListeningPort());

        container.start();

        String brokerUrlTcp = String.format("tcp://127.0.0.1:%d", container.getMappedPort(ACTIVEMQ_PORT));
        String brokerUrlWs = String.format("ws://127.0.0.1:%d", container.getMappedPort(ACTIVEMQ_PORT));

        return CollectionHelper.mapOf(
                "quarkus.artemis.url", brokerUrlTcp,
                "quarkus.artemis.username", ACTIVEMQ_USERNAME,
                "quarkus.artemis.password", ACTIVEMQ_PASSWORD,
                "camel.component.paho.brokerUrl", brokerUrlTcp,
                "camel.component.paho.username", ACTIVEMQ_USERNAME,
                "camel.component.paho.password", ACTIVEMQ_PASSWORD,
                "broker-url.ws", brokerUrlWs);

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #25
Source File: CouchdbTestResource.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, String> start() {
    LOGGER.info(TestcontainersConfiguration.getInstance().toString());

    try {
        container = new GenericContainer(COUCHDB_IMAGE).withExposedPorts(COUCHDB_PORT).waitingFor(Wait.forListeningPort());
        container.start();

        final String authority = container.getContainerIpAddress() + ":" + container.getMappedPort(COUCHDB_PORT).toString();
        return CollectionHelper.mapOf("camel.couchdb.test.server.authority", authority);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #26
Source File: TestRyukImage.java    From presto with Apache License 2.0 5 votes vote down vote up
private TestcontainersConfiguration getDefaultConfiguration()
        throws Exception
{
    Constructor<TestcontainersConfiguration> constructor = TestcontainersConfiguration.class.getDeclaredConstructor(Properties.class, Properties.class);
    constructor.setAccessible(true);
    return constructor.newInstance(new Properties(), new Properties());
}
 
Example #27
Source File: OracleJdbcIndexedSessionRepositoryITests.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@BeforeAll
static void setUpClass() {
	Assumptions.assumeTrue(
			TestcontainersConfiguration.getInstance().getProperties().containsKey("oracle.container.image"),
			"Testcontainers property `oracle.container.image` is set");
}
 
Example #28
Source File: GenericContainer.java    From testcontainers-java with MIT License 4 votes vote down vote up
public GenericContainer() {
    this(TestcontainersConfiguration.getInstance().getTinyImage());
}
 
Example #29
Source File: SocatContainer.java    From testcontainers-java with MIT License 4 votes vote down vote up
public SocatContainer() {
    super(TestcontainersConfiguration.getInstance().getSocatContainerImage());
    withCreateContainerCmdModifier(it -> it.withEntrypoint("/bin/sh"));
    withCreateContainerCmdModifier(it -> it.withName("testcontainers-socat-" + Base58.randomString(8)));
}
 
Example #30
Source File: LocalStackContainer.java    From testcontainers-java with MIT License 4 votes vote down vote up
public LocalStackContainer(String version) {
    super(TestcontainersConfiguration.getInstance().getLocalStackImage() + ":" + version);

    withFileSystemBind("//var/run/docker.sock", "/var/run/docker.sock");
    waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
}