From 3a1d9c772c7a03452d25481988d679076c9141a9 Mon Sep 17 00:00:00 2001 From: Jiri Pechanec Date: Thu, 9 Jan 2025 13:24:54 +0100 Subject: [PATCH] DBZ-8564 Docker Hub registry not used --- .../test/java/io/debezium/server/Images.java | 28 +++++++++++++++++++ .../HttpTestResourceLifecycleManager.java | 4 +-- ...nfinispanTestResourceLifecycleManager.java | 4 +-- .../KafkaTestResourceLifecycleManager.java | 6 ++-- ...JetStreamTestResourceLifecycleManager.java | 4 +-- ...StreamingTestResourceLifecycleManager.java | 4 +-- .../server/pravega/PravegaTestResource.java | 5 ++-- .../PubSubTestResourceLifecycleManager.java | 3 +- .../PulsarTestResourceLifecycleManager.java | 5 ++-- .../server/rabbitmq/RabbitMqContainer.java | 4 ++- .../RedisSSLTestResourceLifecycleManager.java | 4 +-- .../RedisTestResourceLifecycleManager.java | 4 +-- .../server/rocketmq/RocketMqContainer.java | 4 ++- .../sqs/SqsTestResourceLifecycleManager.java | 4 ++- 14 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 debezium-server-core/src/test/java/io/debezium/server/Images.java diff --git a/debezium-server-core/src/test/java/io/debezium/server/Images.java b/debezium-server-core/src/test/java/io/debezium/server/Images.java new file mode 100644 index 00000000..f56802e0 --- /dev/null +++ b/debezium-server-core/src/test/java/io/debezium/server/Images.java @@ -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.9.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"; +} diff --git a/debezium-server-http/src/test/java/io/debezium/server/http/HttpTestResourceLifecycleManager.java b/debezium-server-http/src/test/java/io/debezium/server/http/HttpTestResourceLifecycleManager.java index 1e7012c2..501b0a4a 100644 --- a/debezium-server-http/src/test/java/io/debezium/server/http/HttpTestResourceLifecycleManager.java +++ b/debezium-server-http/src/test/java/io/debezium/server/http/HttpTestResourceLifecycleManager.java @@ -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() { diff --git a/debezium-server-infinispan/src/test/java/io/debezium/server/infinispan/InfinispanTestResourceLifecycleManager.java b/debezium-server-infinispan/src/test/java/io/debezium/server/infinispan/InfinispanTestResourceLifecycleManager.java index 53800f2f..705baee4 100644 --- a/debezium-server-infinispan/src/test/java/io/debezium/server/infinispan/InfinispanTestResourceLifecycleManager.java +++ b/debezium-server-infinispan/src/test/java/io/debezium/server/infinispan/InfinispanTestResourceLifecycleManager.java @@ -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) diff --git a/debezium-server-kafka/src/test/java/io/debezium/server/kafka/KafkaTestResourceLifecycleManager.java b/debezium-server-kafka/src/test/java/io/debezium/server/kafka/KafkaTestResourceLifecycleManager.java index 4fc59a4e..ec52eb8c 100644 --- a/debezium-server-kafka/src/test/java/io/debezium/server/kafka/KafkaTestResourceLifecycleManager.java +++ b/debezium-server-kafka/src/test/java/io/debezium/server/kafka/KafkaTestResourceLifecycleManager.java @@ -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; /** @@ -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 start() { diff --git a/debezium-server-nats-jetstream/src/test/java/io/debezium/server/nats/jetstream/NatsJetStreamTestResourceLifecycleManager.java b/debezium-server-nats-jetstream/src/test/java/io/debezium/server/nats/jetstream/NatsJetStreamTestResourceLifecycleManager.java index b012a8e2..640dc9e0 100644 --- a/debezium-server-nats-jetstream/src/test/java/io/debezium/server/nats/jetstream/NatsJetStreamTestResourceLifecycleManager.java +++ b/debezium-server-nats-jetstream/src/test/java/io/debezium/server/nats/jetstream/NatsJetStreamTestResourceLifecycleManager.java @@ -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; /** @@ -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.*")); diff --git a/debezium-server-nats-streaming/src/test/java/io/debezium/server/nats/streaming/NatsStreamingTestResourceLifecycleManager.java b/debezium-server-nats-streaming/src/test/java/io/debezium/server/nats/streaming/NatsStreamingTestResourceLifecycleManager.java index 531b175f..7c6b7928 100644 --- a/debezium-server-nats-streaming/src/test/java/io/debezium/server/nats/streaming/NatsStreamingTestResourceLifecycleManager.java +++ b/debezium-server-nats-streaming/src/test/java/io/debezium/server/nats/streaming/NatsStreamingTestResourceLifecycleManager.java @@ -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; /** @@ -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.*")); diff --git a/debezium-server-pravega/src/test/java/io/debezium/server/pravega/PravegaTestResource.java b/debezium-server-pravega/src/test/java/io/debezium/server/pravega/PravegaTestResource.java index 71887af6..f278a2e2 100644 --- a/debezium-server-pravega/src/test/java/io/debezium/server/pravega/PravegaTestResource.java +++ b/debezium-server-pravega/src/test/java/io/debezium/server/pravega/PravegaTestResource.java @@ -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; @@ -28,13 +29,11 @@ */ public class PravegaTestResource implements QuarkusTestResourceLifecycleManager { - private static final String PRAVEGA_VERSION = "0.9.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)) diff --git a/debezium-server-pubsub/src/test/java/io/debezium/server/pubsub/PubSubTestResourceLifecycleManager.java b/debezium-server-pubsub/src/test/java/io/debezium/server/pubsub/PubSubTestResourceLifecycleManager.java index 6e8700ba..49d5df56 100644 --- a/debezium-server-pubsub/src/test/java/io/debezium/server/pubsub/PubSubTestResourceLifecycleManager.java +++ b/debezium-server-pubsub/src/test/java/io/debezium/server/pubsub/PubSubTestResourceLifecycleManager.java @@ -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 diff --git a/debezium-server-pulsar/src/test/java/io/debezium/server/pulsar/PulsarTestResourceLifecycleManager.java b/debezium-server-pulsar/src/test/java/io/debezium/server/pulsar/PulsarTestResourceLifecycleManager.java index be677d0d..7e818e0e 100644 --- a/debezium-server-pulsar/src/test/java/io/debezium/server/pulsar/PulsarTestResourceLifecycleManager.java +++ b/debezium-server-pulsar/src/test/java/io/debezium/server/pulsar/PulsarTestResourceLifecycleManager.java @@ -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") diff --git a/debezium-server-rabbitmq/src/test/java/io/debezium/server/rabbitmq/RabbitMqContainer.java b/debezium-server-rabbitmq/src/test/java/io/debezium/server/rabbitmq/RabbitMqContainer.java index 4649cd41..db8b0d29 100644 --- a/debezium-server-rabbitmq/src/test/java/io/debezium/server/rabbitmq/RabbitMqContainer.java +++ b/debezium-server-rabbitmq/src/test/java/io/debezium/server/rabbitmq/RabbitMqContainer.java @@ -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 { - 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; diff --git a/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisSSLTestResourceLifecycleManager.java b/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisSSLTestResourceLifecycleManager.java index fa514e56..f389c681 100644 --- a/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisSSLTestResourceLifecycleManager.java +++ b/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisSSLTestResourceLifecycleManager.java @@ -12,6 +12,7 @@ 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; @@ -19,10 +20,9 @@ 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") diff --git a/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisTestResourceLifecycleManager.java b/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisTestResourceLifecycleManager.java index fdc2433f..cc28320a 100644 --- a/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisTestResourceLifecycleManager.java +++ b/debezium-server-redis/src/test/java/io/debezium/server/redis/RedisTestResourceLifecycleManager.java @@ -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; @@ -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) { diff --git a/debezium-server-rocketmq/src/test/java/io/debezium/server/rocketmq/RocketMqContainer.java b/debezium-server-rocketmq/src/test/java/io/debezium/server/rocketmq/RocketMqContainer.java index 219f37ef..bfd74c64 100644 --- a/debezium-server-rocketmq/src/test/java/io/debezium/server/rocketmq/RocketMqContainer.java +++ b/debezium-server-rocketmq/src/test/java/io/debezium/server/rocketmq/RocketMqContainer.java @@ -17,6 +17,7 @@ import com.github.dockerjava.api.command.InspectContainerResponse; +import io.debezium.server.Images; import io.debezium.testing.testcontainers.util.ContainerImageVersions; /** @@ -26,7 +27,8 @@ public class RocketMqContainer extends GenericContainer { 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; diff --git a/debezium-server-sqs/src/test/java/io/debezium/server/sqs/SqsTestResourceLifecycleManager.java b/debezium-server-sqs/src/test/java/io/debezium/server/sqs/SqsTestResourceLifecycleManager.java index 31124fc5..8fca8f61 100644 --- a/debezium-server-sqs/src/test/java/io/debezium/server/sqs/SqsTestResourceLifecycleManager.java +++ b/debezium-server-sqs/src/test/java/io/debezium/server/sqs/SqsTestResourceLifecycleManager.java @@ -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; @@ -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);