Skip to content

Commit

Permalink
Introduce new property to configure pull.timeout
Browse files Browse the repository at this point in the history
Currently, the pull timeout is set to 2 minutes. This commit introduces
a new property `pull.timeout` to be configured in seconds.

Fixes #9191
  • Loading branch information
eddumelendez committed Oct 18, 2024
1 parent 29b0c5f commit 6436685
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.testcontainers.utility.DockerLoggerFactory;
import org.testcontainers.utility.ImageNameSubstitutor;
import org.testcontainers.utility.LazyFuture;
import org.testcontainers.utility.TestcontainersConfiguration;

import java.time.Duration;
import java.time.Instant;
Expand All @@ -35,7 +36,9 @@
@AllArgsConstructor(access = AccessLevel.PACKAGE)
public class RemoteDockerImage extends LazyFuture<String> {

private static final Duration PULL_RETRY_TIME_LIMIT = Duration.ofMinutes(2);
private static final Duration PULL_RETRY_TIME_LIMIT = Duration.ofSeconds(
TestcontainersConfiguration.getInstance().getImagePullTimeout()
);

@ToString.Exclude
private Future<DockerImageName> imageNameFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ public Integer getImagePullPauseTimeout() {
return Integer.parseInt(getEnvVarOrProperty("pull.pause.timeout", "30"));
}

public Integer getImagePullTimeout() {
return Integer.parseInt(getEnvVarOrProperty("pull.timeout", "120"));
}

public String getImageSubstitutorClassName() {
return getEnvVarOrProperty("image.substitutor", null);
}
Expand Down
3 changes: 3 additions & 0 deletions docs/features/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ but does not allow starting privileged containers, you can turn off the Ryuk con

## Customizing image pull behaviour

> **pull.timeout = 120**
> By default Testcontainers will timeout if pull takes more than this duration (in seconds)
> **pull.pause.timeout = 30**
> By default Testcontainers will abort the pull of an image if the pull appears stalled (no data transferred) for longer than this duration (in seconds).
Expand Down

0 comments on commit 6436685

Please sign in to comment.