From 926527adc32597729ad4734357d318d9717e1b2e Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 21 Jun 2017 13:45:35 +0200 Subject: [PATCH] test: verify `size_to_upgrade_in_bytes` in assertBusy(...) Relates to #25311 --- .../upgrades/FullClusterRestartIT.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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);