Skip to content

Commit 0d59109

Browse files
committed
wait for shard to be allocated before executing a resume follow api
1 parent 1a76cbd commit 0d59109

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

x-pack/qa/rolling-upgrade-multi-cluster/src/test/java/org/elasticsearch/upgrades/CcrRollingUpgradeIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ public void testBiDirectionalIndexFollowing() throws Exception {
275275
index(leaderClient(), "leader_index5", 128);
276276
break;
277277
case ALL:
278+
ensureGreen(followerClient(), "follower_index5");
278279
resumeIndexFollowing(followerClient(), "follower_index5");
280+
ensureGreen(leaderClient(), "follower_index6");
279281
resumeIndexFollowing(leaderClient(), "follower_index6");
280282

281283
assertTotalHitCount("follower_index5", 896, followerClient());
@@ -380,4 +382,13 @@ private static void resumeIndexFollowing(RestClient client, String followerIndex
380382
assertOK(client.performRequest(new Request("POST", "/" + followerIndex + "/_ccr/resume_follow")));
381383
}
382384

385+
private static void ensureGreen(RestClient client, String index) throws IOException {
386+
Request request = new Request("GET", "/_cluster/health/" + index);
387+
request.addParameter("wait_for_status", "green");
388+
request.addParameter("wait_for_no_relocating_shards", "true");
389+
request.addParameter("timeout", "70s");
390+
request.addParameter("level", "shards");
391+
client.performRequest(request);
392+
}
393+
383394
}

0 commit comments

Comments
 (0)