[TEST] Wait for replicas to be allocated before shrinking
The full-cluster-restart tests are run with two nodes. This can lead to situations where the shrink tests fail because
the replicas are not allocated yet and the shrink operation needs the source shards to be available on the same node.
@@ -386,6 +386,8 @@ public class FullClusterRestartIT extends ESRestTestCase {
.endObject();
});
+ ensureGreen(index); // wait for source index to be available on both nodes before starting shrink
+
String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}";
Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(),
new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON));
@@ -451,6 +453,8 @@ public class FullClusterRestartIT extends ESRestTestCase {
.endObject();
});
} else {
+ ensureGreen(index); // wait for source index to be available on both nodes before starting shrink
+
String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}";
Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(),
new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON));
