From 9040f4498eb62dbe58faeb1e9156fe476889d324 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 13 Jul 2017 21:49:26 +0200 Subject: [PATCH] test: wait for index to be green before running all checks --- .../elasticsearch/upgrades/FullClusterRestartIT.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 3d6a5455448..130080117d1 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 @@ -149,6 +149,17 @@ public class FullClusterRestartIT extends ESRestTestCase { } else { count = countOfIndexedRandomDocuments(); } + + Map params = new HashMap<>(); + params.put("timeout", "2m"); + params.put("wait_for_status", "green"); + params.put("wait_for_no_relocating_shards", "true"); + params.put("wait_for_events", "languid"); + Map healthRsp = toMap(client().performRequest("GET", "/_cluster/health/" + index, params)); + logger.info("health api response: {}", healthRsp); + assertEquals("green", healthRsp.get("status")); + assertFalse((Boolean) healthRsp.get("timed_out")); + assertBasicSearchWorks(count); assertAllSearchWorks(count); assertBasicAggregationWorks();