testcontainers / testcontainers-rs

A library for integration-testing against docker containers from within Rust.
https://rust.testcontainers.org
Apache License 2.0
697 stars 133 forks source link

feat!: support waiting from both standard streams #695

Open DDtKey opened 2 months ago

DDtKey commented 2 months ago

Might be useful to avoid duplication in some cases

netlify[bot] commented 2 months ago

Deploy Preview for testcontainers-rust ready!

Name Link
Latest commit 73059717436fea886253df012fd94293e63bfd05
Latest deploy log https://app.netlify.com/sites/testcontainers-rust/deploys/668acd4896539900089b90c3
Deploy Preview https://deploy-preview-695--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 site configuration.

ns-sjorgedeaguiar commented 3 weeks ago

@DDtKey on a related note, am I right that it's not possible to wait for the command to complete? I see that we can wait for messages to be present in stderr/stdout, or for a specific exit code, but there doesn't seem to be a away to wait until the command finishes regardless of the outcome. There's the timeout option but it sleeps for the whole duration, not circuit breaking when the command is finished.

In my case I wrote a wrapper to execute a SQL statement, and wanted to print whatever error occurred when there was some. The exit code or expected message depended on what the caller was doing (e.g. inserting, deleting, etc) and the exit code could be anything. My workaround was to keep polling until an exit code was available.

DDtKey commented 3 weeks ago

Hi @ns-sjorgedeaguiar Yes, that's correct. however I think more appropriate place for the discussion is https://github.com/testcontainers/testcontainers-rs/issues/702

Where you also can find a workaround. But it's something we can support for sure