Skip to content

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

Closed
voronaam wants to merge 2 commits intotestcontainers:masterfrom
voronaam:master
Closed

Fixes issue 2982. ElasticsearchContainer to wait for HTTP_OK response as a signal of being ready.#2983
voronaam wants to merge 2 commits intotestcontainers:masterfrom
voronaam:master

Conversation

@voronaam
Copy link
Copy Markdown

@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
Copy Markdown
Contributor

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

setWaitStrategy(new HttpWaitStrategy()
.forPort(ELASTICSEARCH_DEFAULT_PORT)
.forStatusCodeMatching(response -> response == HTTP_OK || response == HTTP_UNAUTHORIZED)
.forPath("/_cluster/health")
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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.

5 participants