diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index 35902f80f8469..de40f325b8f87 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -292,6 +292,7 @@ protected HttpHost buildHttpHost(String host, int port) { @After public final void cleanUpCluster() throws Exception { if (preserveClusterUponCompletion() == false) { + ensureNoInitializingShards(); wipeCluster(); waitForClusterStateUpdatesToFinish(); logIfThereAreRunningTasks(); @@ -806,7 +807,7 @@ protected static void ensureNoInitializingShards() throws IOException { request.addParameter("wait_for_no_initializing_shards", "true"); request.addParameter("timeout", "70s"); request.addParameter("level", "shards"); - client().performRequest(request); + adminClient().performRequest(request); } protected static void createIndex(String name, Settings settings) throws IOException {