Skip to content

Commit 9c714fb

Browse files
committed
[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.
1 parent 305966c commit 9c714fb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ public void testShrink() throws IOException {
386386
.endObject();
387387
});
388388

389+
ensureGreen(index); // wait for source index to be available on both nodes before starting shrink
390+
389391
String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}";
390392
Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(),
391393
new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON));
@@ -451,6 +453,8 @@ public void testShrinkAfterUpgrade() throws IOException {
451453
.endObject();
452454
});
453455
} else {
456+
ensureGreen(index); // wait for source index to be available on both nodes before starting shrink
457+
454458
String updateSettingsRequestBody = "{\"settings\": {\"index.blocks.write\": true}}";
455459
Response rsp = client().performRequest("PUT", "/" + index + "/_settings", Collections.emptyMap(),
456460
new StringEntity(updateSettingsRequestBody, ContentType.APPLICATION_JSON));

0 commit comments

Comments
 (0)