Skip to content

Commit 37cd832

Browse files
authored
Check that delete index request succeeded in test teardown (#38903) (#38914)
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: #30290 (comment) ) the failure should occurr immediately so it can be diagnosed more easily.
1 parent 6b5ee69 commit 37cd832

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.elasticsearch.cluster.metadata.MetaData;
3131
import org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings;
3232
import org.elasticsearch.common.Priority;
33+
import org.elasticsearch.common.Strings;
3334
import org.elasticsearch.common.settings.Settings;
3435
import org.elasticsearch.common.unit.TimeValue;
3536
import org.elasticsearch.common.util.BigArrays;
@@ -127,6 +128,9 @@ public void tearDown() throws Exception {
127128
metaData.persistentSettings().size(), equalTo(0));
128129
assertThat("test leaves transient cluster metadata behind: " + metaData.transientSettings().keySet(),
129130
metaData.transientSettings().size(), equalTo(0));
131+
GetIndexResponse indices = client().admin().indices().prepareGetIndex().addIndices("*").get();
132+
assertThat("test leaves indices that were not deleted: " + Strings.arrayToCommaDelimitedString(indices.indices()),
133+
indices.indices(), equalTo(Strings.EMPTY_ARRAY));
130134
if (resetNodeAfterTest()) {
131135
assert NODE != null;
132136
stopNode();

0 commit comments

Comments
 (0)