Skip to content

Commit

Permalink
DBZ-8564 Docker Hub registry not used
Browse files Browse the repository at this point in the history
  • Loading branch information
jpechane committed Jan 10, 2025
1 parent 2b59673 commit 4e11a91
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 24 deletions.
28 changes: 28 additions & 0 deletions debezium-server-core/src/test/java/io/debezium/server/Images.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package io.debezium.server;

/**
* The list of container images used in testing
*/
public class Images {

private static final String PRAVEGA_VERSION = "0.13.0";
private static final String PULSAR_VERSION = "2.5.2";

public static final String PRAVEGA_IMAGE = "mirror.gcr.io/pravega/pravega:" + PRAVEGA_VERSION;
public static final String REDIS_IMAGE = "mirror.gcr.io/library/redis";
public static final String PUB_SUB_EMULATOR_IMAGE = "gcr.io/google.com/cloudsdktool/cloud-sdk:380.0.0-emulators";
public static final String KAFKA_IMAGE = "mirror.gcr.io/confluentinc/cp-kafka:5.4.3";
public static final String PULSAR_IMAGE = "mirror.gcr.io/apachepulsar/pulsar:" + PULSAR_VERSION;
public static final String INFINISPAN_IMAGE = "quay.io/infinispan/server:" + System.getProperty("tag.infinispan", "latest");
public static final String LOCALSTACK_IMAGE = "mirror.gcr.io/localstack/localstack";
public static final String RABBITMQ_IMAGE = "mirror.gcr.io/library/rabbitmq:3.12.9-management";
public static final String ROCKETMQ_IMAGE = "mirror.gcr.io/apache/rocketmq";
public static final String WIREMOCK_IMAGE = "mirror.gcr.io/wiremock/wiremock:3.2.0";
public static final String NATS_IMAGE = "mirror.gcr.io/library/nats:latest";
public static final String NATS_STREAMING_IMAGE = "mirror.gcr.io/library/nats-streaming:latest";
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class HttpTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpTestResourceLifecycleManager.class);
public static final String WIREMOCK_IMAGE = "wiremock/wiremock:3.2.0";
public static final int PORT = 8080; // Primary port used by wiremock
private static final AtomicBoolean running = new AtomicBoolean(false);
private static final GenericContainer<?> container = new GenericContainer<>(WIREMOCK_IMAGE)
private static final GenericContainer<?> container = new GenericContainer<>(Images.WIREMOCK_IMAGE)
.withExposedPorts(PORT);

private static synchronized void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.GenericContainer;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class InfinispanTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

private static final Logger LOGGER = LoggerFactory.getLogger(InfinispanTestResourceLifecycleManager.class);
public static final String INFINISPAN_IMAGE = "quay.io/infinispan/server:" + System.getProperty("tag.infinispan", "latest");
public static final int PORT = ConfigurationProperties.DEFAULT_HOTROD_PORT;
public static final String CONFIG_PATH = "/etc/infinispan-local.xml";
private static final GenericContainer<?> container = new GenericContainer<>(INFINISPAN_IMAGE)
private static final GenericContainer<?> container = new GenericContainer<>(Images.INFINISPAN_IMAGE)
.withExposedPorts(PORT)
.withClasspathResourceMapping(InfinispanTestConfigSource.CONFIG_FILE, CONFIG_PATH, BindMode.READ_ONLY)
.withCommand("-c", CONFIG_PATH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import java.util.Map;

import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

/**
Expand All @@ -19,8 +21,8 @@
*/
public class KafkaTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

@SuppressWarnings("deprecation")
private static KafkaContainer kafkaContainer = new KafkaContainer();
private static KafkaContainer kafkaContainer = new KafkaContainer(
DockerImageName.parse(Images.KAFKA_IMAGE).asCompatibleSubstituteFor("confluentinc/cp-kafka"));

@Override
public Map<String, String> start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

/**
Expand All @@ -22,10 +23,9 @@
public class NatsJetStreamTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

public static final int NATS_PORT = 4222;
public static final String NATS_IMAGE = "nats:latest";

private static final AtomicBoolean running = new AtomicBoolean(false);
private static final GenericContainer<?> container = new GenericContainer<>(NATS_IMAGE)
private static final GenericContainer<?> container = new GenericContainer<>(Images.NATS_IMAGE)
.withExposedPorts(NATS_PORT)
.withCommand("-js")
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*Server is ready.*"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

/**
Expand All @@ -22,10 +23,9 @@
public class NatsStreamingTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

public static final int NATS_STREAMING_PORT = 4222;
public static final String NATS_STREAMING_IMAGE = "nats-streaming:latest";

private static final AtomicBoolean running = new AtomicBoolean(false);
private static final GenericContainer<?> container = new GenericContainer<>(NATS_STREAMING_IMAGE)
private static final GenericContainer<?> container = new GenericContainer<>(Images.NATS_STREAMING_IMAGE)
.withExposedPorts(NATS_STREAMING_PORT)
.withCommand("-SD", "-cid", "debezium")
.waitingFor(new LogMessageWaitStrategy().withRegEx(".*Server is ready.*"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;

import io.debezium.server.Images;
import io.pravega.client.admin.StreamManager;
import io.pravega.client.stream.ScalingPolicy;
import io.pravega.client.stream.StreamConfiguration;
Expand All @@ -28,13 +29,11 @@
*/
public class PravegaTestResource implements QuarkusTestResourceLifecycleManager {

private static final String PRAVEGA_VERSION = "0.13.0";
public static final int CONTROLLER_PORT = 9090;
public static final int SEGMENT_STORE_PORT = 12345;
public static final String PRAVEGA_IMAGE = "pravega/pravega:" + PRAVEGA_VERSION;

@SuppressWarnings("deprecation")
private static final GenericContainer<?> container = new FixedHostPortGenericContainer<>(PRAVEGA_IMAGE)
private static final GenericContainer<?> container = new FixedHostPortGenericContainer<>(Images.PRAVEGA_IMAGE)
.withFixedExposedPort(CONTROLLER_PORT, CONTROLLER_PORT)
.withFixedExposedPort(SEGMENT_STORE_PORT, SEGMENT_STORE_PORT)
.withStartupTimeout(Duration.ofSeconds(90))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import org.testcontainers.containers.PubSubEmulatorContainer;
import org.testcontainers.utility.DockerImageName;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class PubSubTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

public PubSubEmulatorContainer emulator = new PubSubEmulatorContainer(
DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk:380.0.0-emulators"));
DockerImageName.parse(Images.PUB_SUB_EMULATOR_IMAGE));
private static String endpoint;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class PulsarTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

private static final String PULSAR_VERSION = "2.5.2";
public static final int PULSAR_PORT = 6650;
public static final int PULSAR_HTTP_PORT = 8080;
public static final String PULSAR_IMAGE = "apachepulsar/pulsar:" + PULSAR_VERSION;

private static final GenericContainer<?> container = new GenericContainer<>(PULSAR_IMAGE)
private static final GenericContainer<?> container = new GenericContainer<>(Images.PULSAR_IMAGE)
.withStartupTimeout(Duration.ofSeconds(90))
.waitingFor(Wait.forLogMessage(".*messaging service is ready.*", 1))
.withCommand("bin/pulsar", "standalone")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

import io.debezium.server.Images;

/**
* RabbitMQ container
*/
public class RabbitMqContainer extends GenericContainer<RabbitMqContainer> {

private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("rabbitmq:3.12.9-management");
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse(Images.RABBITMQ_IMAGE);
public static final int BROKER_PORT = 5672;
public static final int STREAM_PORT = 5552;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.GenericContainer;

import io.debezium.server.Images;
import io.debezium.server.TestConfigSource;
import io.debezium.util.Testing;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class RedisSSLTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

public static final int REDIS_PORT = 6379;
public static final String REDIS_IMAGE = "redis";

private static final AtomicBoolean running = new AtomicBoolean(false);
private static final GenericContainer<?> container = new GenericContainer<>(REDIS_IMAGE)
private static final GenericContainer<?> container = new GenericContainer<>(Images.REDIS_IMAGE)
.withClasspathResourceMapping("ssl", "/etc/certificates", BindMode.READ_ONLY)
.withCommand(
"redis-server --tls-port 6379 --port 0 --tls-cert-file /etc/certificates/redis.crt --tls-key-file /etc/certificates/redis.key --tls-ca-cert-file /etc/certificates/ca.crt")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;

import io.debezium.server.Images;
import io.debezium.server.TestConfigSource;
import io.debezium.util.Testing;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
Expand All @@ -24,10 +25,9 @@ public class RedisTestResourceLifecycleManager implements QuarkusTestResourceLif
static final String READY_MESSAGE = "Ready to accept connections";
public static final int REDIS_PORT = 6379;
public static final int HOST_PORT = 16379;
public static final String REDIS_IMAGE = "redis";

private static final AtomicBoolean running = new AtomicBoolean(false);
private static final FixedHostPortGenericContainer<?> container = new FixedHostPortGenericContainer<>(REDIS_IMAGE)
private static final FixedHostPortGenericContainer<?> container = new FixedHostPortGenericContainer<>(Images.REDIS_IMAGE)
.withFixedExposedPort(HOST_PORT, REDIS_PORT);

private static synchronized void start(boolean ignored) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.github.dockerjava.api.command.InspectContainerResponse;

import io.debezium.server.Images;
import io.debezium.testing.testcontainers.util.ContainerImageVersions;

/**
Expand All @@ -26,7 +27,8 @@ public class RocketMqContainer extends GenericContainer<RocketMqContainer> {
private static final Logger LOGGER = LoggerFactory.getLogger(RocketMqContainer.class);

private static final String ROCKETMQ_VERSION = ContainerImageVersions.getStableVersion("apache/rocketmq", ContainerImageVersions.NUMBERS_ONLY_VERSION_REGEX_PATTERN);
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("apache/rocketmq:" + ROCKETMQ_VERSION);
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName
.parse(Images.ROCKETMQ_IMAGE + ":" + ROCKETMQ_VERSION);
private static final int defaultBrokerPermission = 6;
public static final int NAMESRV_PORT = 9876;
public static final int BROKER_PORT = 10911;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.testcontainers.containers.localstack.LocalStackContainer.Service;
import org.testcontainers.utility.DockerImageName;

import io.debezium.server.Images;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
Expand All @@ -32,7 +33,8 @@
*/
public class SqsTestResourceLifecycleManager implements QuarkusTestResourceLifecycleManager {

private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("localstack/localstack");
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse(Images.LOCALSTACK_IMAGE)
.asCompatibleSubstituteFor("localstack/localstack");

private static final LocalStackContainer container = new LocalStackContainer(DEFAULT_IMAGE_NAME)
.withServices(Service.SQS);
Expand Down

0 comments on commit 4e11a91

Please sign in to comment.