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

How to wait for container to finish running? #676

Closed KShivendu closed 2 months ago

KShivendu commented 2 months ago

I want to wait for my container to exit naturally with exit code = 0. How can I achieve this?

DDtKey commented 2 months ago

Hi! Could you elaborate on this? What's the case? The container performs some work and you want it to finish before proceeding with your flow?

Currently there is no such wait strategy in Rust implementation at least, but we can consider the support of this. Shouldn't be a big deal

KShivendu commented 2 months ago

want it to finish before proceeding with your flow?

Yes

but we can consider the support of this

Would be great. I think Golang already has this.

While the feature isn't there, is there some hack that I can rely on? I just want to know when the container has stopped.

DDtKey commented 2 months ago

ExitWaitStrategy has been implemented and released in 0.20.0 🚀

There is no need in workaround anymore (it was generally possible using logs, but that's dirty)