testcontainers-rs icon indicating copy to clipboard operation
testcontainers-rs copied to clipboard

feat: added CommandStrategy with SuccessfulCommand enum

Open sutt0n opened this issue 7 months ago • 2 comments

Potentially resolves #702

This introduces a new wait strategy, CommandStrategy. The goal here is to wait for a successful command (exit code 0) prior to marking a container as ready. This polls the container state to ensure it's running first, and then executes the given command. Once the command has an exit code of 0, then the strategy has completed.

There are options to fail fast, as well as customize the exit code, just to expose flexibility for the strategy.

Open to changes / updates, if required -- this language is not my day-to-day.

sutt0n avatar Mar 30 '25 19:03 sutt0n

Deploy Preview for testcontainers-rust ready!

Name Link
Latest commit 9e1c3dbc6ede64bd5f01b9ad25bc33256192680d
Latest deploy log https://app.netlify.com/projects/testcontainers-rust/deploys/68730f5ace06fd0008447740
Deploy Preview https://deploy-preview-782--testcontainers-rust.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Mar 30 '25 19:03 netlify[bot]

Force pushed to fix the commit message... hard to write Rust while holding a sleeping baby. 😅

sutt0n avatar Apr 06 '25 13:04 sutt0n

Sorry again for the long delay.

@sutt0n, do you think this solution would address your use case as well? I find it more natural and aligned with the Docker interface, while still offering nearly the same functionality — the ability to wait for an arbitrary command to succeed during startup.

DDtKey avatar Jul 16 '25 16:07 DDtKey