wait for shard to be allocated before executing a resume follow api

This commit is contained in:
Martijn van Groningen 2019-02-18 14:50:12 +01:00
parent 45b17e8645
commit e8ea85d6e9
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 11 additions and 0 deletions

View File

@ -272,7 +272,9 @@ public class CcrRollingUpgradeIT extends AbstractMultiClusterUpgradeTestCase {
index(leaderClient(), "leader_index5", 128);
break;
case ALL:
ensureGreen(followerClient(), "follower_index5");
resumeIndexFollowing(followerClient(), "follower_index5");
ensureGreen(leaderClient(), "follower_index6");
resumeIndexFollowing(leaderClient(), "follower_index6");
assertTotalHitCount("follower_index5", 896, followerClient());
@ -374,4 +376,13 @@ 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);
}
}