Skip to content

Commit e8ea85d

Browse files
committed
wait for shard to be allocated before executing a resume follow api
1 parent 45b17e8 commit e8ea85d

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

+11
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ public void testBiDirectionalIndexFollowing() throws Exception {
272272
index(leaderClient(), "leader_index5", 128);
273273
break;
274274
case ALL:
275+
ensureGreen(followerClient(), "follower_index5");
275276
resumeIndexFollowing(followerClient(), "follower_index5");
277+
ensureGreen(leaderClient(), "follower_index6");
276278
resumeIndexFollowing(leaderClient(), "follower_index6");
277279

278280
assertTotalHitCount("follower_index5", 896, followerClient());
@@ -374,4 +376,13 @@ private static void resumeIndexFollowing(RestClient client, String followerIndex
374376
assertOK(client.performRequest(new Request("POST", "/" + followerIndex + "/_ccr/resume_follow")));
375377
}
376378

379+
private static void ensureGreen(RestClient client, String index) throws IOException {
380+
Request request = new Request("GET", "/_cluster/health/" + index);
381+
request.addParameter("wait_for_status", "green");
382+
request.addParameter("wait_for_no_relocating_shards", "true");
383+
request.addParameter("timeout", "70s");
384+
request.addParameter("level", "shards");
385+
client.performRequest(request);
386+
}
387+
377388
}

0 commit comments

Comments
 (0)