-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No waitingFor() method in DockerComposeContainer #174
Comments
Hi Luis Yes, I'll reinstate. I'm afraid I'd not anticipated that use case. I imagine you must be relying on a call to getServicePort in your If you could possibly share some demo code for how you're using this it Thanks RichardRichard |
Because of problems with |
Sorry this didn't make it into 1.1.4 :( |
Suggest we move Thoughts @rnorth ? |
Potentially @outofcoffee; I can see there being some complication in needing different wait strategies for different child containers. So we'd need a way of telling testcontainers which wait strategy corresponds to which service, wouldn't we? |
Agree; I've implemented this by abstracting the port exposure stuff into a higher level 'EndpointBuilder', which works like this:
When calling To do this, Endpoint, GenericContainer and DockerComposeContainer implement an interface with methods like 'waitingFor', 'withExposedPort' and 'getMappedPort'. |
Hi all, are there any updates on this maybe? This feature would greatly help us because we need to wait until certain events have taken place until we can start our component tests. |
I've been having a quick look at this, and was wondering would it be a good idea to add an overloaded Something like: public SELF withExposedService(String serviceName, int servicePort, @NonNull WaitStrategy waitStrategy) Example usage: new DockerComposeContainer(new File("test-compose.yml"))
.withExposedService("redis_1", 6379, Wait.forListeningPort())
.withExposedService("elasticsearch_1", 9200, Wait.forHttp("/all").forStatusCode(200)); The |
Hi @barrycommins, |
Hi @bsideup, I looked at this a like bit at the time. I think things are a little complicated due to the use of Ambassador containers. I think it'd be easy enough to apply WaitStrategy to the Ambassador containers, but more difficult to apply them to the proxied containers, which is what you'd really need. This is a feature I'd really like though, so I'll try to get back to it in the next couple of weeks, and see what's possible. |
Hey @barrycommins, just as a heads up, the old ambassador container has been changed to |
…oach (#600) * Support for WaitStrategy on DockerComposeContainer As discussed in #174 * CI code quality fixes * CI code quality fixes * Another attempt at adding WaitStrategy support for docker-compose * Another attempt at adding WaitStrategy support for docker-compose fixed some tests and added some files missed from previous commit * Changes after code review comments Added new WaitStrategyTarget interface, plus moved some methods into new LogFollower and CommandExecutor interfaces * Changes after code review comments Removed CommandExecutor and LogFollower interfaces. Added ExecInContainerPattern utility class. Changed existing WaitStrategy implementations to inherit from new ones * CI code quality fixes * Changes from code review. Moved getMappedPort to default implementation in ContainerState. Using proxyContainer in ComposeStrategyWaitServiceTarget to get ip. Removed unnecessary null checks. Using lazy getter for containerInfo in ComposeStrategyWaitServiceTarget. * Changes from code review. Removed getLogger() method. Removed getContainerName from Container and ContainerState. Removed getExposedPortNumbers from ContainerState. Added waitingFor method to DockerComposeContainer. Removed StartupTimeout interface.
Released in 1.7.0 (already in Bintray's JCenter, will be synced with Maven Central soon) |
Using version 1.1.0, the
DockerComposeContainer
class no longer extends fromGenericContainer
and thus doesn't have anything like thewaitingFor
method.Related issues:
The text was updated successfully, but these errors were encountered: