Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;

public class ArangoDbContainer extends GenericContainer {
public class ArangoDbContainer extends GenericContainer<ArangoDbContainer> {
public static final Integer PORT_DEFAULT = 8529;

private static final Logger LOGGER = LoggerFactory.getLogger(ArangoDbContainer.class);
Expand All @@ -40,10 +40,10 @@ public ArangoDbContainer(String containerName) {

setWaitStrategy(Wait.forListeningPort());
addFixedExposedPort(PORT_DEFAULT, PORT_DEFAULT);
withNetworkAliases(CONTAINER_NAME);
withEnv(ARANGO_NO_AUTH, "1");
withLogConsumer(new Slf4jLogConsumer(LOGGER));
waitingFor(Wait.forLogMessage(".*is ready for business. Have fun!.*", 1));
withNetworkAliases(CONTAINER_NAME)
.withEnv(ARANGO_NO_AUTH, "1")
.withLogConsumer(new Slf4jLogConsumer(LOGGER))
.waitingFor(Wait.forLogMessage(".*is ready for business. Have fun!.*", 1));
}

public int getServicePort() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ public ArtemisContainer() {
.withBuildArg(FROM_IMAGE_ARG, TestUtils.prependHubImageNamePrefixIfNeeded(FROM_IMAGE_NAME)));

withExposedPorts(DEFAULT_MQTT_PORT, DEFAULT_AMQP_PORT,
DEFAULT_ADMIN_PORT, DEFAULT_ACCEPTOR_PORT);

waitingFor(Wait.forListeningPort());
DEFAULT_ADMIN_PORT, DEFAULT_ACCEPTOR_PORT)
.waitingFor(Wait.forListeningPort());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public void setupServices(String serviceList) {
}

protected void setupContainer() {
withExposedPorts(SERVICE_PORT);
waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
withExposedPorts(SERVICE_PORT)
.waitingFor(Wait.forLogMessage(".*Ready\\.\n", 1));
}

public AwsCredentialsProvider getCredentialsProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ public AzuriteContainer() {
public AzuriteContainer(String containerName) {
super(containerName);

withExposedPorts(AzureServices.BLOB_SERVICE, AzureServices.QUEUE_SERVICE);

waitingFor(Wait.forListeningPort());
withExposedPorts(AzureServices.BLOB_SERVICE, AzureServices.QUEUE_SERVICE)
.waitingFor(Wait.forListeningPort());
}

public AzureCredentialsHolder azureCredentials() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ public DispatchRouterContainer() {
"org/apache/camel/test/infra/dispatch/router/services/Dockerfile")
.withBuildArg(FROM_IMAGE_ARG, TestUtils.prependHubImageNamePrefixIfNeeded(FROM_IMAGE_NAME)));

withExposedPorts(DEFAULT_AMQP_PORT);

waitingFor(Wait.forListeningPort());
withExposedPorts(DEFAULT_AMQP_PORT)
.waitingFor(Wait.forListeningPort());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public final class KafkaProperties {
public static final String KAFKA_CONTAINER = "kafka.container";
public static final String KAFKA3_CONTAINER = "kafka3.container";
public static final String KAFKA2_CONTAINER = "kafka2.container";
public static final String REDPANDA_CONTAINER = "itest.redpanda.container.image";
public static final String STRIMZI_CONTAINER = "itest.strimzi.container.image";
public static final String REDPANDA_CONTAINER = "redpanda.container.image";
public static final String STRIMZI_CONTAINER = "strimzi.container.image";

private KafkaProperties() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public TransientAuthenticatedKafkaContainer(String jaasConfigFile) {

final MountableFile mountableFile = MountableFile.forClasspathResource(jaasConfigFile);
LOG.debug("Using mountable file at: {}", mountableFile.getFilesystemPath());
withCopyFileToContainer(mountableFile, "/tmp/kafka-jaas.config");

withEnv("KAFKA_OPTS", "-Djava.security.auth.login.config=/tmp/kafka-jaas.config")
withCopyFileToContainer(mountableFile, "/tmp/kafka-jaas.config")
.withEnv("KAFKA_OPTS", "-Djava.security.auth.login.config=/tmp/kafka-jaas.config")
.withEnv("KAFKA_LISTENERS", "PLAINTEXT://0.0.0.0:9093,BROKER://0.0.0.0:9092")
.withEnv("KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL", "PLAIN")
.withEnv("KAFKA_LISTENER_SECURITY_PROTOCOL_MAP", "PLAINTEXT:SASL_PLAINTEXT,BROKER:PLAINTEXT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,19 @@ public StrimziContainer(Network network, String name, String zookeeperInstanceNa
public StrimziContainer(Network network, String name, String containerName, String zookeeperInstanceName) {
super(containerName);

withEnv("LOG_DIR", "/tmp/logs");
withExposedPorts(KAFKA_PORT);
withEnv("KAFKA_ADVERTISED_LISTENERS", String.format("PLAINTEXT://%s:9092", getHost()));
withEnv("KAFKA_LISTENERS", "PLAINTEXT://0.0.0.0:9092");
withEnv("KAFKA_ZOOKEEPER_CONNECT", zookeeperInstanceName + ":2181");
withNetwork(network);

withCreateContainerCmdModifier(createContainerCmd -> setupContainer(name, createContainerCmd));

withCommand("sh", "-c",
"bin/kafka-server-start.sh config/server.properties "
+ "--override listeners=${KAFKA_LISTENERS} "
+ "--override advertised.listeners=${KAFKA_ADVERTISED_LISTENERS} "
+ "--override zookeeper.connect=${KAFKA_ZOOKEEPER_CONNECT}");

waitingFor(Wait.forListeningPort());
withEnv("LOG_DIR", "/tmp/logs")
.withExposedPorts(KAFKA_PORT)
.withEnv("KAFKA_ADVERTISED_LISTENERS", String.format("PLAINTEXT://%s:9092", getHost()))
.withEnv("KAFKA_LISTENERS", "PLAINTEXT://0.0.0.0:9092")
.withEnv("KAFKA_ZOOKEEPER_CONNECT", zookeeperInstanceName + ":2181")
.withNetwork(network)
.withCreateContainerCmdModifier(createContainerCmd -> setupContainer(name, createContainerCmd))
.withCommand("sh", "-c",
"bin/kafka-server-start.sh config/server.properties "
+ "--override listeners=${KAFKA_LISTENERS} "
+ "--override advertised.listeners=${KAFKA_ADVERTISED_LISTENERS} "
+ "--override zookeeper.connect=${KAFKA_ZOOKEEPER_CONNECT}")
.waitingFor(Wait.forListeningPort());
}

private void setupContainer(String name, CreateContainerCmd createContainerCmd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ public ZookeeperContainer(Network network, String name) {
public ZookeeperContainer(Network network, String name, String containerName) {
super(containerName);

withEnv("LOG_DIR", "/tmp/logs");
withExposedPorts(ZOOKEEPER_PORT);
withNetwork(network);

withCreateContainerCmdModifier(createContainerCmd -> setupContainer(name, createContainerCmd));

withCommand("sh", "-c",
"bin/zookeeper-server-start.sh config/zookeeper.properties");

waitingFor(Wait.forListeningPort());
withEnv("LOG_DIR", "/tmp/logs")
.withExposedPorts(ZOOKEEPER_PORT)
.withNetwork(network)
.withCreateContainerCmdModifier(createContainerCmd -> setupContainer(name, createContainerCmd))
.withCommand("sh", "-c", "bin/zookeeper-server-start.sh config/zookeeper.properties")
.waitingFor(Wait.forListeningPort());
}

private void setupContainer(String name, CreateContainerCmd createContainerCmd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
## ---------------------------------------------------------------------------
kafka3.container=confluentinc/cp-kafka:7.4.0
kafka2.container=confluentinc/cp-kafka:5.5.12
itest.redpanda.container.image=docker.redpanda.com/vectorized/redpanda:v23.1.1
itest.strimzi.container.image=quay.io/strimzi/kafka:latest-kafka-3.5.1
redpanda.container.image=docker.redpanda.com/vectorized/redpanda:v23.1.1
strimzi.container.image=quay.io/strimzi/kafka:latest-kafka-3.5.1
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ public OllamaContainer(DockerImageName image, Integer port, String model, String
this.port = port;
this.model = model;
this.imageName = imageName;
withExposedPorts(port);
withImagePullPolicy(dockerImageName -> !dockerImageName.getVersionPart().endsWith(model));
setWaitStrategy(Wait.forListeningPort());
withLogConsumer(new Slf4jLogConsumer(LOGGER));

withExposedPorts(port)
.withImagePullPolicy(dockerImageName -> !dockerImageName.getVersionPart().endsWith(model))
.withLogConsumer(new Slf4jLogConsumer(LOGGER))
.setWaitStrategy(Wait.forListeningPort());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public QdrantContainer(DockerImageName imageName) {
protected void configure() {
super.configure();

withExposedPorts(HTTP_PORT, GRPC_PORT);
withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)));
waitingFor(Wait.forLogMessage(".*Actix runtime found; starting in Actix runtime.*", 1));
withExposedPorts(HTTP_PORT, GRPC_PORT)
.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)))
.waitingFor(Wait.forLogMessage(".*Actix runtime found; starting in Actix runtime.*", 1));
}

public String getGrpcHost() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;

public class XmppServerContainer extends GenericContainer {
public class XmppServerContainer extends GenericContainer<XmppServerContainer> {

private static final Logger LOGGER = LoggerFactory.getLogger(XmppServerContainer.class);
private static final String CONTAINER_NAME = "vysper-wrapper";
Expand All @@ -37,10 +37,10 @@ public class XmppServerContainer extends GenericContainer {
public XmppServerContainer() {
super(LocalPropertyResolver.getProperty(XmppServerContainer.class, XmppProperties.XMPP_CONTAINER));
setWaitStrategy(Wait.forListeningPort());
withExposedPorts(XmppProperties.PORT_DEFAULT, PORT_REST);
withNetworkAliases(CONTAINER_NAME);
withLogConsumer(new Slf4jLogConsumer(LOGGER));
waitingFor(Wait.forLogMessage(".*Started Application in.*", 1));
withExposedPorts(XmppProperties.PORT_DEFAULT, PORT_REST)
.withNetworkAliases(CONTAINER_NAME)
.withLogConsumer(new Slf4jLogConsumer(LOGGER))
.waitingFor(Wait.forLogMessage(".*Started Application in.*", 1));
}

public String getUrl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.Wait;

public class ZooKeeperContainer extends GenericContainer {
public class ZooKeeperContainer extends GenericContainer<ZooKeeperContainer> {
public static final String CONTAINER_NAME = "zookeeper";
public static final int CLIENT_PORT = 2181;

Expand All @@ -41,18 +41,18 @@ public ZooKeeperContainer(String name) {

setWaitStrategy(Wait.forListeningPort());

withNetworkAliases(name);
withExposedPorts(CLIENT_PORT);
withLogConsumer(new Slf4jLogConsumer(LOGGER));
withNetworkAliases(name)
.withExposedPorts(CLIENT_PORT)
.withLogConsumer(new Slf4jLogConsumer(LOGGER));
}

public ZooKeeperContainer(String name, int clientPort) {
super(name);

setWaitStrategy(Wait.forListeningPort());

withNetworkAliases(name);
withLogConsumer(new Slf4jLogConsumer(LOGGER));
withNetworkAliases(name)
.withLogConsumer(new Slf4jLogConsumer(LOGGER));

if (clientPort > 0) {
addFixedExposedPort(clientPort, CLIENT_PORT);
Expand Down