Skip to content
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

Improve WaitAllStrategy. #1272

Merged
merged 6 commits into from
Apr 10, 2019

Conversation

michael-simons
Copy link
Contributor

This is a PR addressing #1269.

I have split it up into two commits:

  1. Remove deprecations from the WaitAllStrategyTest (don't test deprecated but current classes, update references to Moskitos argument matchers), can be cherry picked.
  2. Change the behaviour of WaitAllStrategy: It now pushes down it's own timeout to all children. I have added then additional tests respectively removed the own using a mock.

@bsideup bsideup added this to the next milestone Feb 25, 2019
@testcontainers testcontainers deleted a comment Feb 25, 2019
@testcontainers testcontainers deleted a comment Feb 25, 2019
@testcontainers testcontainers deleted a comment from michael-simons Feb 25, 2019
@kiview
Copy link
Member

kiview commented Feb 25, 2019

Do we have a race conditions in the tests, that is happening on CI? Looks like this on CirlceCI and Travis was hanging. I retriggered both.

@michael-simons
Copy link
Contributor Author

Hmm, @kiview I added tests with timeouts not longer than 20 milliseconds. If they hang, that would be somewhere deeper.

Maybe CI hang because I forced push onto this branch?

@rnorth
Copy link
Member

rnorth commented Mar 3, 2019

I've retriggered the CI jobs - let's see...

@testcontainers testcontainers deleted a comment Mar 3, 2019
@testcontainers testcontainers deleted a comment Mar 3, 2019
@testcontainers testcontainers deleted a comment Mar 3, 2019
@testcontainers testcontainers deleted a comment Mar 4, 2019
@testcontainers testcontainers deleted a comment Mar 4, 2019
@testcontainers testcontainers deleted a comment Mar 4, 2019
@testcontainers testcontainers deleted a comment Mar 4, 2019
@rnorth
Copy link
Member

rnorth commented Mar 12, 2019

I've rerun the build several times but it's looking like it's always getting stuck here:

Gradle Test Executor 1 > org.testcontainers.junit.DockerComposeWaitStrategyTest > testWaitingFails STARTED
Too long with no output (exceeded 10m0s)

Given that this test involves wait strategies too, I get the feeling that there's something broken. I've not had time to dig into what, just yet.

@michael-simons
Copy link
Contributor Author

That would be this one, right?

Does it involve the WaitAllStrategy at all?
This is my main change:
https://github.com/testcontainers/testcontainers-java/pull/1272/files#diff-7b2fedcd67314c538c802560f884fc52R31

@michael-simons
Copy link
Contributor Author

Oh yes it does indeed:
https://github.com/testcontainers/testcontainers-java/blob/master/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java#L334

The newly created WaitAllStrategy pushes down it's 30 minutes wait them now to the wait strategy passed on the method.
Yeah, that's the expected outcome of my change.

So that "hang" could be fixed by fixing https://github.com/testcontainers/testcontainers-java/blob/master/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java#L334 which could need some improvement IMHO. The logic described in the comment feels wrong.
What happens if I even pass in a WaitAll for a composed container?

Have to think about that for a bit.
Is there a chance that @bsideup or @kiview are in JavaLand next week? We could discuss this there…

@kiview
Copy link
Member

kiview commented Mar 12, 2019

@michael-simons Yes I will be at Javaland, would be cool to look into this together and maybe hack on it :)

@bsideup bsideup modified the milestone: next Mar 13, 2019
@rnorth rnorth modified the milestone: next Mar 22, 2019
@bsideup bsideup removed this from the next milestone Mar 24, 2019
Only test current and not deprecated strategies and remove usage of
deprecated Mockito argument matchers.
Currently, inner (child) waiting strategies handling their own timeout,
don't play nice with the wait all strategy.

The commit fixes this by pushing down the configured timeout to all
children.
@michael-simons
Copy link
Contributor Author

Hi @kiview. Here’s the change as discussed in JavaLand. It took the longest time to think about names.

If you want to make sure that wait all times out when using individual timeouts I’d suggest using another enclosing strategy instead of mixing those concerns.

Apart from that, I rebased on master.

@michael-simons
Copy link
Contributor Author

Or, if you prefer a failsafe, that could be another mode, that doesn’t do the check on changing timeouts and doesn’t push down the timeouts to the inner strategies. I could add this as well.

While thinking about it: would be a nice solution in the end.

@michael-simons
Copy link
Contributor Author

That should cover now all the modes.

@kiview
Copy link
Member

kiview commented Mar 25, 2019

Re-triggered Circle-CI, it seems this was something during dependency download.

@kiview
Copy link
Member

kiview commented Mar 25, 2019

@rnorth @bsideup
@michael-simons and me discussed this PR at Javaland and we thought this new change (although it changes the default behavior) is more in line of what a user is actually expecting from the GenericContainer.withStartupTimeout() method.

In the current implementation, a user won't be able to use GenericContainer.withStartupTimeout() with containers that already implement a more sophisticated waiting strategy (e.g. BrowserWebDriverContainer, which will always apply the inner LogMessageWaitStrategy timeout).

So while we are breaking the default behavior here, I'm in favor of doing it.
As an alternative, we can keep the default as is and just add the configurability part from this PR.

@kiview kiview added this to the next milestone Apr 10, 2019
@kiview kiview merged commit 3fff974 into testcontainers:master Apr 10, 2019
@kiview
Copy link
Member

kiview commented Apr 10, 2019

Merged, thanks to @michael-simons :)

@rnorth
Copy link
Member

rnorth commented Apr 16, 2019

Released in 1.11.2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants