[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.
This commit is contained in:
Yannick Welsch 2018-01-08 10:02:56 +01:00
parent db186311c6
commit ae9c3281fc

View File

@ -388,6 +388,8 @@ public class FullClusterRestartIT extends ESRestTestCase {
.endObject(); .endObject();
}); });
ensureGreen(index); // wait for source index to be available on both nodes before starting shrink
String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}"; String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}";
Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(), Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(),
new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON)); new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON));
@ -453,6 +455,8 @@ public class FullClusterRestartIT extends ESRestTestCase {
.endObject(); .endObject();
}); });
} else { } else {
ensureGreen(index); // wait for source index to be available on both nodes before starting shrink
String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}"; String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}";
Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(), Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(),
new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON)); new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON));