mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Add ensureGreen method for use with adminClient (#113425)
Current ensureGreen test helper method uses client() directly. Sometimes is useful to call ensureGreen with adminClient() or another rest client. This PR allows passing a RestClient into ensureGreen.
This commit is contained in:
parent
d07d167430
commit
c17cf18d5d
3 changed files with 13 additions and 9 deletions
5
docs/changelog/113425.yaml
Normal file
5
docs/changelog/113425.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
pr: 113425
|
||||
summary: Add `ensureGreen` test method for use with `adminClient`
|
||||
area: Infra/Metrics
|
||||
type: enhancement
|
||||
issues: []
|
|
@ -1721,7 +1721,11 @@ public abstract class ESRestTestCase extends ESTestCase {
|
|||
* @param index index to test for
|
||||
**/
|
||||
public final void ensureGreen(String index) throws IOException {
|
||||
ensureHealth(index, (request) -> {
|
||||
ensureGreen(client(), index);
|
||||
}
|
||||
|
||||
public final void ensureGreen(RestClient client, String index) throws IOException {
|
||||
ensureHealth(client, index, (request) -> {
|
||||
request.addParameter("wait_for_status", "green");
|
||||
request.addParameter("wait_for_no_relocating_shards", "true");
|
||||
final String ensureGreenTimeout = getEnsureGreenTimeout();
|
||||
|
|
|
@ -405,13 +405,8 @@ public class CcrRollingUpgradeIT extends AbstractMultiClusterUpgradeTestCase {
|
|||
assertOK(client.performRequest(new Request("POST", "/" + followerIndex + "/_ccr/resume_follow")));
|
||||
}
|
||||
|
||||
private static void ensureGreen(RestClient client, String index) throws IOException {
|
||||
Request request = new Request("GET", "/_cluster/health/" + index);
|
||||
request.addParameter("wait_for_status", "green");
|
||||
request.addParameter("wait_for_no_relocating_shards", "true");
|
||||
request.addParameter("timeout", "70s");
|
||||
request.addParameter("level", "shards");
|
||||
client.performRequest(request);
|
||||
@Override
|
||||
protected final String getEnsureGreenTimeout() {
|
||||
return "70s";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue