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

Why is `WaitStrategy` pub(crate) scope?

Open jamfor999 opened this issue 9 months ago • 3 comments

It would be incredibly useful to be able to define custom WaitStrategy implementations. For example, checking a port is properly accessible.

It's unclear why the WaitStrategy trait is scoped to pub(crate), effectively removing this capability.

jamfor999 avatar Feb 22 '25 16:02 jamfor999

The entire testcontainers(for Rust) implementation was rewritten at some point. So the interface wasn't considered stable.

Making it public would prevent us from breaking change under the hood.

At the same time it's not that common to implement custom wait strategy. Usually, all of them can be useful on the crate level.

I don't think there is any other reason. And I guess we already can consider exposing it, because it's been around for a while already. However it may require some additional changes, because we also use WaitFor enum (custom option is needed)

But, perhaps you can consider contributing to the crate? It might be useful for the community

DDtKey avatar Feb 22 '25 18:02 DDtKey

The entire testcontainers(for Rust) implementation was rewritten at some point. So the interface wasn't considered stable.

Making it public would prevent us from breaking change under the hood.

At the same time it's not that common to implement custom wait strategy. Usually, all of them can be useful on the crate level.

I don't think there is any other reason. And I guess we already can consider exposing it, because it's been around for a while already. However it may require some additional changes, because we also use WaitFor enum (custom option is needed)

But, perhaps you can consider contributing to the crate? It might be useful for the community

In fairness, all I would want personally is a simple 'wait for port to be available' waiting strategy, which when I was looking for it I couldn't find. It exists in the Java equivalent and is quite common to use. Maybe one to consider, I might look into contributing that one soon

jamfor999 avatar Feb 22 '25 21:02 jamfor999

Yes, having such a strategy totally makes sense and I would be happy to accept a PR 🙏

But let us know if you won't be able to dedicate time, so we'll add it to the plans

DDtKey avatar Feb 22 '25 22:02 DDtKey