diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java index 1d9e9a7205d..705d17825f7 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java @@ -427,12 +427,14 @@ public class FullClusterRestartIT extends ESRestTestCase { assertEquals(200, r.getStatusLine().getStatusCode()); // Post upgrade checks: - rsp = toMap(client().performRequest("GET", "/" + index + "/_upgrade")); - indexUpgradeStatus = (Map) XContentMapValues.extractValue("indices." + index, rsp); - totalBytes = (Integer) indexUpgradeStatus.get("size_in_bytes"); - assertThat(totalBytes, greaterThan(0)); - toUpgradeBytes = (Integer) indexUpgradeStatus.get("size_to_upgrade_in_bytes"); - assertEquals(0, toUpgradeBytes); + assertBusy(() -> { + Map rsp2 = toMap(client().performRequest("GET", "/" + index + "/_upgrade")); + Map indexUpgradeStatus2 = (Map) XContentMapValues.extractValue("indices." + index, rsp2); + int totalBytes2 = (Integer) indexUpgradeStatus2.get("size_in_bytes"); + assertThat(totalBytes2, greaterThan(0)); + int toUpgradeBytes2 = (Integer) indexUpgradeStatus2.get("size_to_upgrade_in_bytes"); + assertEquals(0, toUpgradeBytes2); + }); rsp = toMap(client().performRequest("GET", "/" + index + "/_segments")); Map shards = (Map) XContentMapValues.extractValue("indices." + index + ".shards", rsp);