Take Docker registry from the DOCKER_REGISTRY_URL
Add a logic into the `TestUtils` to take a Docker registry URL from the `DOCKER_REGISTRY_URL` ENV variable. Use the value in the `GenericContainer` for image to pull. Fallback to an official registry if no value
This commit is contained in:
@@ -20,6 +20,8 @@ import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Artem Bilan
|
||||
@@ -31,7 +33,7 @@ public interface MosquittoContainerTest {
|
||||
|
||||
@Container
|
||||
GenericContainer<?> MOSQUITTO_CONTAINER =
|
||||
new GenericContainer<>("eclipse-mosquitto:2.0.12")
|
||||
new GenericContainer<>(TestUtils.dockerRegistryFromEnv() + "eclipse-mosquitto:2.0.12")
|
||||
.withCommand("mosquitto -c /mosquitto-no-auth.conf")
|
||||
.withReuse(true)
|
||||
.withExposedPorts(1883);
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
|
||||
@@ -374,6 +375,10 @@ public abstract class TestUtils {
|
||||
ctx.updateLoggers();
|
||||
}
|
||||
|
||||
public static String dockerRegistryFromEnv() {
|
||||
return Optional.ofNullable(System.getenv("DOCKER_REGISTRY_URL")).orElse("");
|
||||
}
|
||||
|
||||
public static class LevelsContainer {
|
||||
|
||||
private final Map<Class<?>, Level> classLevels;
|
||||
|
||||
Reference in New Issue
Block a user