Unable to provide timeout for waiting
When using "wait for" there seems to be no timeout.
While you can add a timeout to tests in general, it would make more sense for me to put a much shorter timeout for the startup of a container.
When using "wait for" there seems to be no timeout.
Correct.
Generally, we try to ship testcontainers in a way that works out-of-the-box, i.e. with pinned versions of containers and statically-encoded parameters and env variables. Green tests on our side should therefore ensure that this particular image will always work for the end user.
What is the usecase in which you would have needed a timeout?
While it would certainly be possible to pass or configure one, I'd be more interested in making it harder / impossible to use a docker image through testcontainers in a way that it wouldn't successfully start up.
What is the usecase in which you would have needed a timeout?
The issue I ran into is that it looks like Postgres containers fail to start up properly on GitHub actions. So the expected line doesn't show up in the logs, and the whole job is stuck.
While it would certainly be possible to pass or configure one, I'd be more interested in making it harder / impossible to use a docker image through testcontainers in a way that it wouldn't successfully start up.
I think there will always be a case you didn't think about. Allowing to put in a timeout make total sense to me.
That makes sense, thanks for sharing!
Do you think we should have a fixed timeout or something that is configurable per container?
I am leaning towards a global one that can maybe be overridden through an env variable to keep the images themselves simple.
I am leaning towards a global one that can maybe be overridden through an env variable to keep the images themselves simple.
Sounds reasonable to me. If additional requirements come up, it should be easy to extend. But it should also cover most cases already.
I propose a default timeout of 1 minute for now.
If we want to make this configurable, https://github.com/testcontainers/testcontainers-rs/pull/259 should be a good foundation for that. I am thinking of something like:
TESTCONTAINERS=ready_timeout=2m,keep