From 7f70e7014e1c81325414f6e5ff018d2bf369238e Mon Sep 17 00:00:00 2001 From: Martin Ocenas Date: Wed, 20 Nov 2024 13:31:30 +0100 Subject: [PATCH] Retry container launch if failed --- .../services/containers/DockerContainerManagedResource.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quarkus-test-containers/src/main/java/io/quarkus/test/services/containers/DockerContainerManagedResource.java b/quarkus-test-containers/src/main/java/io/quarkus/test/services/containers/DockerContainerManagedResource.java index 3c56173a8..132850504 100644 --- a/quarkus-test-containers/src/main/java/io/quarkus/test/services/containers/DockerContainerManagedResource.java +++ b/quarkus-test-containers/src/main/java/io/quarkus/test/services/containers/DockerContainerManagedResource.java @@ -37,6 +37,8 @@ public abstract class DockerContainerManagedResource implements ManagedResource public static final String DOCKER_INNER_CONTAINER = DockerContainerManagedResource.class.getName() + "_inner"; private static final String DELETE_IMAGE_ON_STOP_PROPERTY = "container.delete.image.on.stop"; private static final String TARGET = "target"; + private static final int CONTAINER_STARTUP_ATTEMPTS = Integer.parseInt( + System.getProperty("ts.global.container-startup-attempts", "1")); private final ServiceContext context; @@ -65,6 +67,7 @@ public void start() { innerContainer.withStartupTimeout(context.getOwner().getConfiguration() .getAsDuration(SERVICE_STARTUP_TIMEOUT, SERVICE_STARTUP_TIMEOUT_DEFAULT)); innerContainer.withEnv(resolveProperties()); + innerContainer.withStartupAttempts(CONTAINER_STARTUP_ATTEMPTS); loggingHandler = new TestContainersLoggingHandler(context.getOwner(), innerContainer); loggingHandler.startWatching();