-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support multiple HTTP status codes for HttpWaitStrategy #630
Merged
bsideup
merged 17 commits into
testcontainers:master
from
dadoonet:pr/http-multiple-ports
Apr 13, 2018
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cf637ce
Support multiple HTTP status codes for HttpWaitStrategy
dadoonet da44bd9
Revert changes in Deprecated class
dadoonet 0af2eab
Merge branch 'master' into pr/http-multiple-ports
dadoonet e5ddd16
Revert changes in Deprecated class
dadoonet 1b7cbaf
Make forStatusCode chainable and add forStatusCodeMatching method
dadoonet f2d1592
Fix quality
dadoonet bf12100
Fix compile issue
dadoonet 3b34909
Support both Predicates and Status codes
dadoonet afe06dc
Fix setter
dadoonet 9f1b28a
Revert unrelated change
dadoonet cb4875d
Merge branch 'master' into pr/http-multiple-ports
dadoonet bb39373
Fix error message (note that with predicates it might be incorrect th…
dadoonet 10ca9cd
Fix default predicate
dadoonet 370c35a
Move WaitStrategy tests to the right package
dadoonet 808dcf8
Add a test (and fix the bug!)
dadoonet d6837f7
Add more tests
dadoonet 6b24c2a
Add entry in changelog
dadoonet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.Wait; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unrelated to this PR |
||
|
||
import java.io.IOException; | ||
|
||
|
@@ -30,7 +30,7 @@ public class VaultContainerTest { | |
.withSecretInVault("secret/testing2", "secret_one=password1", | ||
"secret_two=password2", "secret_three=password3", "secret_three=password3", | ||
"secret_four=password4") | ||
.waitingFor(Wait.forHttp("/v1/secret/testing1").forStatusCode(400)); | ||
.waitingFor(Wait.forHttp("/v1/secret/testing1").forStatusCodes(400)); | ||
|
||
@Test | ||
public void readFirstSecretPathWithCli() throws IOException, InterruptedException { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really think we should deprecate the old API? From a technical standpoint you are of course right, I'm just thinking about the developer experience, with a lot of people using this API right now I assume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep this method and add one more with ranges. ES' case (two values, 200 and 401) is not as popular as e.g. ranges like 200-299 where any 2xx code is considered valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, to keep this PR small, we can allow calling
forStatusCode
multiple times:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works for the ES module, I'd be fine with calling the method multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsideup
Yeah. I thought about that as well as I saw how fabric8 docker maven plugin offers that as well. But my plan was to come with this later may be with something like
forStatusCodes(String...)
.Yeah. I agree with this proposal. And I can then support as well:
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forStatusCode(200, 299)
is too unambiguous :(I would actually go for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also keep
forStatusCode
, plus maybe make it chain-able (Wait.forHttp("/all").forStatusCode(200).forStatusCode(401)
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Sounds like great ideas. I'll do that