From 588cf2c9b7dcb9803018402e8acde5ce788794c8 Mon Sep 17 00:00:00 2001 From: William Brafford Date: Tue, 27 Apr 2021 15:51:57 -0400 Subject: [PATCH] Feature reset integration test should tolerate failed resets (#72326) * Remove redundant section of test * Mention in javadoc that we check task index specifically --- .../java/org/elasticsearch/client/FeaturesIT.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/FeaturesIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/FeaturesIT.java index 3ebe1ad8a5fbb..d62d032f5d9b7 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/FeaturesIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/FeaturesIT.java @@ -17,10 +17,7 @@ import java.io.IOException; import java.util.Collections; -import java.util.Set; -import java.util.stream.Collectors; -import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.notNullValue; @@ -37,6 +34,12 @@ public void testGetFeatures() throws IOException { assertTrue(response.getFeatures().stream().anyMatch(feature -> "tasks".equals(feature.getFeatureName()))); } + /** + * This test assumes that at least one of our defined features should reset successfully. + * Since plugins should be testing their own reset operations if they use something + * other than the default, this test tolerates failures in the response from the + * feature reset API. We just need to check that we can reset the "tasks" system index. + */ public void testResetFeatures() throws IOException { ResetFeaturesRequest request = new ResetFeaturesRequest(); @@ -54,11 +57,5 @@ public void testResetFeatures() throws IOException { assertThat(response.getFeatureResetStatuses().size(), greaterThan(1)); assertTrue(response.getFeatureResetStatuses().stream().anyMatch( feature -> "tasks".equals(feature.getFeatureName()) && "SUCCESS".equals(feature.getStatus()))); - - Set statuses = response.getFeatureResetStatuses().stream() - .map(ResetFeaturesResponse.ResetFeatureStateStatus::getStatus) - .collect(Collectors.toSet()); - - assertThat(statuses, contains("SUCCESS")); } }