testcontainers / testcontainers-go

Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
https://golang.testcontainers.org
MIT License
3.32k stars 451 forks source link

[Feature]: Hold open a connection to ryuk during a call to Up #2621

Open maxmzkr opened 1 week ago

maxmzkr commented 1 week ago

Problem

When using the compose module and the services take a bit to start up, the ryuk container will timeout and close during the call to Up.

Examples in https://github.com/testcontainers/testcontainers-go/issues/2618 https://github.com/testcontainers/testcontainers-go/issues/2563

Solution

Hold a connection to the ryuk container during the lifetime of the Up call.

Benefit

More complex or longer start up time docker compose files will be able to start without requiring users to set higher timeout configurations.

Alternatives

Increasing the ryuk connection/reconnect timeouts. This would help, but it requires every runner of the test to know to set the higher timeout. Because we know we don't want to close the ryuk container while Up is being run, it makes sense to make it work without the need for configuration changes.

Would you like to help contributing this feature?

Yes

maxmzkr commented 1 week ago

Following a chain from here https://github.com/testcontainers/testcontainers-go/issues/2618