diff --git a/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java b/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java index af14b28ae7d7a..8f8382c6971e7 100644 --- a/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java +++ b/qa/rolling-upgrade/src/test/java/org/opensearch/upgrades/IndexingIT.java @@ -38,7 +38,6 @@ import org.opensearch.Version; import org.opensearch.client.Request; import org.opensearch.client.Response; -import org.opensearch.client.ResponseException; import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.common.Booleans; import org.opensearch.common.settings.Settings; @@ -90,7 +89,8 @@ private void printClusterNodes() throws IOException, ParseException, URISyntaxEx private void waitForSearchableDocs(String index, int shardCount) throws Exception { Map primaryShardToNodeIDMap = new HashMap<>(); Map replicaShardToNodeIDMap = new HashMap<>(); - logger.info("--> _cat/shards \n{}", EntityUtils.toString(client().performRequest(new Request("GET", "/_cat/shards?v")).getEntity())); + waitForClusterHealthWithNoShardMigration(index, "green"); + logger.info("--> _cat/shards before search \n{}", EntityUtils.toString(client().performRequest(new Request("GET", "/_cat/shards?v")).getEntity())); Request request = new Request("GET", index + "/_stats"); request.addParameter("level", "shards");