Skip to content

Commit

Permalink
Retry container launch if failed
Browse files Browse the repository at this point in the history
(cherry picked from commit b8a77e1)
  • Loading branch information
mocenas authored and jcarranzan committed Nov 26, 2024
1 parent 43e34d9 commit 7a56fec
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.quarkus.test.bootstrap.ManagedResource;
import io.quarkus.test.bootstrap.Protocol;
import io.quarkus.test.bootstrap.ServiceContext;
import io.quarkus.test.configuration.PropertyLookup;
import io.quarkus.test.logging.Log;
import io.quarkus.test.logging.LoggingHandler;
import io.quarkus.test.logging.TestContainersLoggingHandler;
Expand All @@ -37,6 +38,7 @@ 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 PropertyLookup CONTAINER_STARTUP_ATTEMPTS = new PropertyLookup("container-startup-attempts", "1");

private final ServiceContext context;

Expand Down Expand Up @@ -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.getAsInteger());

loggingHandler = new TestContainersLoggingHandler(context.getOwner(), innerContainer);
loggingHandler.startWatching();
Expand Down

0 comments on commit 7a56fec

Please sign in to comment.