HealthcheckWaitStrategy class

Waits until a container's Docker health check reports 'healthy'.

Polls the container's inspect data (State.Health.Status) via WaitStrategyTarget.wrappedContainer. Requires the container's image to have a HEALTHCHECK instruction or a health check injected at runtime.

Behaviour:

  • 'healthy' → ready.
  • 'starting' → keeps polling.
  • 'unhealthy' → throws StateError immediately with log output.
  • null or empty → throws StateError (no health check configured).

Example:

container.waitingFor(HealthcheckWaitStrategy());
Inheritance

Constructors

HealthcheckWaitStrategy()

Properties

hashCode int
The hash code for this object.
no setterinherited
pollInterval Duration
Time between successive polling attempts.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startupTimeout Duration
Maximum time to wait for the container to become ready.
getter/setter pairinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
poll(Future<bool> check(), {List<Type>? transientExceptions}) Future<bool>
Adaptive polling loop.
inherited
toString() String
A string representation of this object.
inherited
waitUntilReady(WaitStrategyTarget target) Future<void>
Polls the container's built-in health-check status until 'healthy'.
override
withPollInterval(Duration interval) WaitStrategy
Sets the poll interval between readiness checks.
inherited
withStartupTimeout(Duration timeout) WaitStrategy
Sets the maximum startup timeout.
inherited
withTransientExceptions(List<Type> exceptions) WaitStrategy
Adds exceptions to the set of exception types that are treated as transient failures during polling.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited