test: wait for index to be green before running all checks

This commit is contained in:
Martijn van Groningen 2017-07-13 21:49:26 +02:00
parent 5189bd14f1
commit 9040f4498e
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
1 changed files with 11 additions and 0 deletions

View File

@ -149,6 +149,17 @@ public class FullClusterRestartIT extends ESRestTestCase {
} else { } else {
count = countOfIndexedRandomDocuments(); count = countOfIndexedRandomDocuments();
} }
Map<String, String> 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<String, Object> 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); assertBasicSearchWorks(count);
assertAllSearchWorks(count); assertAllSearchWorks(count);
assertBasicAggregationWorks(); assertBasicAggregationWorks();