Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions docs/changelog/113425.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 113425
summary: Add `ensureGreen` test method for use with `adminClient`
area: Infra/Metrics
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,11 @@ protected String getEnsureGreenTimeout() {
* @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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,8 @@ private static void resumeIndexFollowing(RestClient client, String followerIndex
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";
}

}