Check that delete index request succeeded in test teardown (#38903) (#38913)

Backport of #38903

When tearing down from `ESSingleNodeTestCase` we perform a delete on "*"
indices, it some cases, however, those indices are not fully deleted. Rather
than have a failure occur later down the change (see:
https://github.com/elastic/elasticsearch/issues/30290#issuecomment-463589008 )
the failure should occurr immediately so it can be diagnosed more easily.
This commit is contained in:
Lee Hinman 2019-02-14 13:46:17 -07:00 committed by GitHub
parent 00cb8d0be8
commit 7d449c5f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.BigArrays;
@ -127,6 +128,9 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
metaData.persistentSettings().size(), equalTo(0));
assertThat("test leaves transient cluster metadata behind: " + metaData.transientSettings().keySet(),
metaData.transientSettings().size(), equalTo(0));
GetIndexResponse indices = client().admin().indices().prepareGetIndex().addIndices("*").get();
assertThat("test leaves indices that were not deleted: " + Strings.arrayToCommaDelimitedString(indices.indices()),
indices.indices(), equalTo(Strings.EMPTY_ARRAY));
if (resetNodeAfterTest()) {
assert NODE != null;
stopNode();