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

How to wait for container to finish running?

Open KShivendu opened this issue 1 year ago • 2 comments

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

KShivendu avatar Jul 03 '24 20:07 KShivendu

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

DDtKey avatar Jul 03 '24 21:07 DDtKey

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.

KShivendu avatar Jul 04 '24 03:07 KShivendu

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)

DDtKey avatar Jul 07 '24 15:07 DDtKey