Browse Source

Feature reset integration test should tolerate failed resets (#72326)

* Remove redundant section of test
* Mention in javadoc that we check task index specifically
William Brafford 4 years ago
parent
commit
8f0e5dcadd

+ 6 - 9
client/rest-high-level/src/test/java/org/elasticsearch/client/FeaturesIT.java

@@ -17,10 +17,7 @@ import org.elasticsearch.search.SearchModule;
 
 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 class FeaturesIT extends ESRestHighLevelClientTestCase {
         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 class FeaturesIT extends ESRestHighLevelClientTestCase {
         assertThat(response.getFeatureResetStatuses().size(), greaterThan(1));
         assertTrue(response.getFeatureResetStatuses().stream().anyMatch(
             feature -> "tasks".equals(feature.getFeatureName()) && "SUCCESS".equals(feature.getStatus())));
-
-        Set<String> statuses = response.getFeatureResetStatuses().stream()
-            .map(ResetFeaturesResponse.ResetFeatureStateStatus::getStatus)
-            .collect(Collectors.toSet());
-
-        assertThat(statuses, contains("SUCCESS"));
     }
 }