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

Fix HttpWaitStrategy.forStatusCodeMatching used with HttpWaitStrategy.forStatusCode #881

Merged
merged 1 commit into from
Sep 25, 2018

Conversation

dadoonet
Copy link
Contributor

@dadoonet dadoonet commented Sep 24, 2018

In #630 we introduced predicates but with a default one which is always present whatever is passed in the forStatusCodeMatching() method.

This commit adds a test that demonstrates the issue:

  • We have a service returning 200 OK
  • The predicate expects anything which is a code >= to 300
  • The test should throw a Timeout as this condition is never reached but without the current fix, the test never throws the Timeout as 200 matches the default builtin predicate.

This commit fixes the problem by checking at startup time what is/are the predicates that needs to be applied.

Note that in most cases, an HTTP service is expected to throw a 200 OK status so that fix might not fix actually any real problem and might be a theory only. But I'd prefer to have code that actually implements what is supposed to work.

Closes #880.

….forStatusCode

In #630 we introduced predicates but with a default one which is always present whatever what is passed in the `forStatusCodeMatching()` method.

This commit adds a test that demonstrates the issue:

* We have a service returning `200 OK`
* The predicate expects anything which is a code >= to `300`
* The test should throw a Timeout as this condition is never reached but without the current fix, the test never throws the Timeout as 200 matches the default builtin predicate.

This commit fixes the problem by checking at startup time what is/are the predicates that needs to be applied.

Note that in most cases, an HTTP service is expected to throw a `200 OK` status so that fix might not fix actually any real problem and might be a theory only. But I'd prefer to have code that actually implements what is supposed to work.

Closes #880.
Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, good catch. Thanks for contributing the fix.

@rnorth rnorth merged commit ef9b592 into testcontainers:master Sep 25, 2018
@dadoonet dadoonet deleted the fix/880-wait-strategy branch September 25, 2018 08:11
@dadoonet
Copy link
Contributor Author

Thanks for merging! Should I have updated the release notes?

@kiview
Copy link
Member

kiview commented Sep 25, 2018

@dadoonet No need for this, we are now using release-drafter to generate the baseline of our release notes 🙂

@kiview kiview added this to the next milestone Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HttpWaitStrategy.forStatusCodeMatching always expect 200 code
3 participants