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

Fixes issue 2982. ElasticsearchContainer to wait for HTTP_OK response as a signal of being ready. #2983

Closed
wants to merge 2 commits into from

Conversation

voronaam
Copy link

@voronaam voronaam commented Jul 8, 2020

Changes the default wait strategy on the ElasticsearchContainer to not require users of the class to amend the strategy for the simple unit tests.

@slovdahl
Copy link
Contributor

Just to make the PR properly cross-referenced: #2982

@@ -52,7 +51,8 @@ public ElasticsearchContainer(String dockerImageName) {
addExposedPorts(ELASTICSEARCH_DEFAULT_PORT, ELASTICSEARCH_DEFAULT_TCP_PORT);
setWaitStrategy(new HttpWaitStrategy()
.forPort(ELASTICSEARCH_DEFAULT_PORT)
.forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED)
.forPath("/_cluster/health")
Copy link
Contributor

Choose a reason for hiding this comment

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

This endpoint is probably not available either when the cluster is secured AFAIK. I don't think this can work as is IMO.
I'd let the default behavior.

But we can add this nice idea in #2321 which adds a simple withPassword() method which makes the cluster secured. There we can add

.withBasicCredentials("elastic", password)

and just check the HTTP_OK status.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are correct. This is what I have described in the comment as well: #2982 (comment)

(Sorry for causing confusion by keeping most of the conversation on the issue, not the pull request)

@stale
Copy link

stale bot commented Jan 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

@stale stale bot added the stale label Jan 24, 2021
@rnorth rnorth removed the stale label Jun 24, 2021
@eddumelendez
Copy link
Member

Thanks for the PR! #2982 is already closed and solved via #2320 and #2321

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.

None yet

5 participants