waitUntilReady method

  1. @override
Future<void> waitUntilReady(
  1. WaitStrategyTarget target
)
override

Runs command inside the container on each poll cycle until its exit code equals expectedExitCode.

Throws TimeoutException when startupTimeout elapses without the expected exit code being returned.

Implementation

@override
Future<void> waitUntilReady(WaitStrategyTarget target) async {
  final ready = await poll(() async {
    final (exitCode, _) = await target.exec(command);
    return exitCode == expectedExitCode;
  });

  if (!ready) {
    throw TimeoutException(
      'Exec command $command did not return $expectedExitCode '
      'within $startupTimeout',
    );
  }
}