Skip to content

Apply one startup deadline from container start to ready #1582

Open

Description

@cristianrgreco

What happens

withStartupTimeout(ms) reads as "the container must be ready within this long". It is applied per phase instead, so start() can take several times longer than the value given before it fails:

  • The image pull has no limit.
  • The port-binding wait has its own fixed 30 second limit, separate from the startup timeout.
  • The wait strategy gets the full timeout, counted from the moment the wait begins.
  • Modules that wait again in containerStarted restart the clock. Kafka and Redpanda apply startupTimeoutMs to a second wait, so a Kafka container with its default of 180 seconds can run for close to 360 before failing.

Expected

One deadline, fixed when the container is started. The port-binding wait, the wait strategy and the hooks each get what is left of it. When it runs out, the error says which phase was waiting and what the total budget was.

Where

  • startContainer and reuseContainer in packages/testcontainers/src/generic-container/generic-container.ts
  • packages/testcontainers/src/generic-container/inspect-container-util-ports-exposed.ts
  • packages/testcontainers/src/wait-strategies/wait-strategy.ts and every strategy
  • containerStarted in the kafka, redpanda and couchbase modules

Notes

Dependencies

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmajorAn incompatible API change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions