From f538b30af9e61cf1c2929dcae6850b1c280cae3d Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Wed, 27 Feb 2019 15:56:33 -0800 Subject: [PATCH] ensure no initializing shards during cluster cleanup (#39283) (#39480) there are testing situations where newly created indices are being wiped before they are fully initialized. This results in an edge-case in the shard-locking strategy where an index cannot be deleted. This should fix that --- .../main/java/org/elasticsearch/test/rest/ESRestTestCase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 {