Skip to content

Commit

Permalink
Retry container launch if failed
Browse files Browse the repository at this point in the history
  • Loading branch information
mocenas committed Nov 20, 2024
1 parent 82515ec commit 7f70e70
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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);

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

0 comments on commit 7f70e70

Please sign in to comment.