Fixes issue 2982. ElasticsearchContainer to wait for HTTP_OK response as a signal of being ready.#2983
Fixes issue 2982. ElasticsearchContainer to wait for HTTP_OK response as a signal of being ready.#2983voronaam wants to merge 2 commits intotestcontainers:masterfrom
Conversation
… as a signal of being ready.
|
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
|
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. |
Changes the default wait strategy on the ElasticsearchContainer to not require users of the class to amend the strategy for the simple unit tests.