Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Support `AbortSignal` in `start()`, `exec` and other long-running calls

Aperta
#1,560 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, node.js, typescript
Ambito
backend, testing

Direzione di ricerca

Start by reading start and startContainer in packages/testcontainers/src/generic-container/generic-container.ts, then trace image pull and build, wait strategies, exec, and Compose up in the listed files. Check the coordination requirements for #1558, #1548, and #1582 before changing shared interfaces. Done means long-running calls accept an AbortSignal, reject with its reason on abort, and clean up partially created resources.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement minor

What happens

Nothing in the API accepts an AbortSignal.

  • 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:

await new GenericContainer(image).start({ signal: AbortSignal.timeout(30_000) });
await container.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.
  • Related: #1081 asked for this. It was closed when the reporter's underlying problem turned out to be something else.
  • A startup deadline is a signal with a timeout. One mechanism can serve both this and #1582.

Dependencies

  • Stack on #1558: both change the wait strategy interface. Change it once, in the same major.
  • Coordinate with #1548: exec gains a timeout there. Make the two agree.
  • Coordinate with #1582: the deadline can be carried by the same signal.
Lingua principale
TypeScript
Stelle
2.6k
Fork
274
Merge medio
1g 14h
PR unite (30g)
44

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di testcontainers/testcontainers-node

Tutte le issue di testcontainers/testcontainers-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.