You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support AbortSignal in start(), exec and other long-running calls #1560
start() can spend minutes pulling an image and waiting for readiness. When the test runner times the test out, or the user gives up, the start carries on in the background. The container is still created and stays until Ryuk removes it at process exit.
The only timeout is the wait strategy's startup timeout. It does not cover the image pull.
exec has no timeout and cannot be cancelled, so a command that hangs blocks its caller indefinitely.
DockerComposeEnvironment.up() and GenericContainerBuilder.build() are the same.
Expected
Long-running operations take a signal:
awaitnewGenericContainer(image).start({signal: AbortSignal.timeout(30_000)});awaitcontainer.exec(["pg_dump"],{ signal });
On abort the promise rejects with the signal's reason, and whatever was half-created (container, network attachment, Compose project) is stopped and removed.
Where
start and startContainer in packages/testcontainers/src/generic-container/generic-container.ts
pull and build in packages/testcontainers/src/container-runtime/clients/image/docker-image-client.ts
packages/testcontainers/src/wait-strategies/*.ts
exec in packages/testcontainers/src/container-runtime/clients/container/docker-container-client.ts
up in packages/testcontainers/src/docker-compose-environment/docker-compose-environment.ts
Notes
Go passes a context.Context to every call. .NET takes a CancellationToken.
Activity