Răsfoiți Sursa

Remove tests and branches that will never execute (#38772)

* Remove tests that will never execute and dead branches

These tests have an version conditioned `assumeTrue` that only makes
them run on versions prior to `v7.0.0`, but for current master at
`v8.0.0` this will never happen.
Alpar Torok 6 ani în urmă
părinte
comite
689147556e

+ 13 - 29
qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

@@ -25,7 +25,6 @@ import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.client.ResponseException;
 import org.elasticsearch.client.RestClient;
-import org.elasticsearch.client.WarningFailureException;
 import org.elasticsearch.cluster.metadata.IndexMetaData;
 import org.elasticsearch.common.Booleans;
 import org.elasticsearch.common.CheckedFunction;
@@ -62,7 +61,6 @@ import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.hasSize;
 import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.Matchers.startsWith;
 
 /**
  * Tests to run before and after a full cluster restart. This is run twice,
@@ -273,6 +271,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
                     mappingsAndSettings.endObject();
                 }
                 mappingsAndSettings.endObject();
+
                 mappingsAndSettings.startObject("settings");
                 {
                     mappingsAndSettings.field("index.number_of_shards", 5);
@@ -428,7 +427,9 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
             bulk.append("{\"index\":{}}\n");
             bulk.append("{\"test\":\"test\"}\n");
         }
+
         Request bulkRequest = new Request("POST", "/" + index + "_write/_bulk");
+
         bulkRequest.setJsonEntity(bulk.toString());
         bulkRequest.addParameter("refresh", "");
         assertThat(EntityUtils.toString(client().performRequest(bulkRequest).getEntity()), containsString("\"errors\":false"));
@@ -563,8 +564,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
         client().performRequest(updateRequest);
 
         Request getRequest = new Request("GET", "/" + index + "/_doc/" + docId);
-        if (getOldClusterVersion().before(Version.V_6_7_0)) {
-        }
+
         Map<String, Object> getRsp = entityAsMap(client().performRequest(getRequest));
         Map<?, ?> source = (Map<?, ?>) getRsp.get("_source");
         assertTrue("doc does not contain 'foo' key: " + source, source.containsKey("foo"));
@@ -960,26 +960,10 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
         assertEquals(singletonList(tookOnVersion.toString()), XContentMapValues.extractValue("snapshots.version", listSnapshotResponse));
 
         // Remove the routing setting and template so we can test restoring them.
-        try {
-            Request clearRoutingFromSettings = new Request("PUT", "/_cluster/settings");
-            clearRoutingFromSettings.setJsonEntity("{\"persistent\":{\"cluster.routing.allocation.exclude.test_attr\": null}}");
-            client().performRequest(clearRoutingFromSettings);
-        } catch (WarningFailureException e) {
-            /*
-             * If this test is executed on the upgraded mode before testRemoteClusterSettingsUpgraded,
-             * we will hit a warning exception because we put some deprecated settings in that test.
-             */
-            if (isRunningAgainstOldCluster() == false) {
-                for (String warning : e.getResponse().getWarnings()) {
-                    assertThat(warning, containsString(
-                        "setting was deprecated in Elasticsearch and will be removed in a future release! "
-                            + "See the breaking changes documentation for the next major version."));
-                    assertThat(warning, startsWith("[search.remote."));
-                }
-            } else {
-                throw e;
-            }
-        }
+        Request clearRoutingFromSettings = new Request("PUT", "/_cluster/settings");
+        clearRoutingFromSettings.setJsonEntity("{\"persistent\":{\"cluster.routing.allocation.exclude.test_attr\": null}}");
+        client().performRequest(clearRoutingFromSettings);
+
         client().performRequest(new Request("DELETE", "/_template/test_template"));
 
         // Restore
@@ -1007,7 +991,9 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
             bulk.append("{\"index\":{\"_id\":\"").append(count + i).append("\"}}\n");
             bulk.append("{\"test\":\"test\"}\n");
         }
+
         Request writeToRestoredRequest = new Request("POST", "/restored_" + index + "/_bulk");
+
         writeToRestoredRequest.addParameter("refresh", "true");
         writeToRestoredRequest.setJsonEntity(bulk.toString());
         assertThat(EntityUtils.toString(client().performRequest(writeToRestoredRequest).getEntity()), containsString("\"errors\":false"));
@@ -1035,14 +1021,12 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
 
         Map<String, Object> getTemplateResponse = entityAsMap(client().performRequest(getTemplateRequest));
         Map<String, Object> expectedTemplate = new HashMap<>();
-        if (isRunningAgainstOldCluster() && getOldClusterVersion().before(Version.V_6_0_0_beta1)) {
-            expectedTemplate.put("template", "evil_*");
-        } else {
-            expectedTemplate.put("index_patterns", singletonList("evil_*"));
-        }
+        expectedTemplate.put("index_patterns", singletonList("evil_*"));
+
         expectedTemplate.put("settings", singletonMap("index", singletonMap("number_of_shards", "1")));
         expectedTemplate.put("mappings", singletonMap("_source", singletonMap("enabled", true)));
 
+
         expectedTemplate.put("order", 0);
         Map<String, Object> aliases = new HashMap<>();
         aliases.put("alias1", emptyMap());

+ 0 - 78
qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartSettingsUpgradeIT.java

@@ -19,84 +19,6 @@
 
 package org.elasticsearch.upgrades;
 
-import org.elasticsearch.Version;
-import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsResponse;
-import org.elasticsearch.client.Request;
-import org.elasticsearch.client.Response;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.settings.Setting;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.xcontent.XContentBuilder;
-import org.elasticsearch.common.xcontent.XContentParser;
-import org.elasticsearch.common.xcontent.json.JsonXContent;
-import org.elasticsearch.transport.RemoteClusterService;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
-import static org.elasticsearch.transport.RemoteClusterAware.SEARCH_REMOTE_CLUSTERS_SEEDS;
-import static org.elasticsearch.transport.RemoteClusterService.SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE;
-import static org.hamcrest.Matchers.equalTo;
-
 public class FullClusterRestartSettingsUpgradeIT extends AbstractFullClusterRestartTestCase {
 
-    public void testRemoteClusterSettingsUpgraded() throws IOException {
-        assumeTrue("skip_unavailable did not exist until 6.1.0", getOldClusterVersion().onOrAfter(Version.V_6_1_0));
-        assumeTrue("settings automatically upgraded since 6.5.0", getOldClusterVersion().before(Version.V_6_5_0));
-        if (isRunningAgainstOldCluster()) {
-            final Request putSettingsRequest = new Request("PUT", "/_cluster/settings");
-            try (XContentBuilder builder = jsonBuilder()) {
-                builder.startObject();
-                {
-                    builder.startObject("persistent");
-                    {
-                        builder.field("search.remote.foo.skip_unavailable", true);
-                        builder.field("search.remote.foo.seeds", Collections.singletonList("localhost:9200"));
-                    }
-                    builder.endObject();
-                }
-                builder.endObject();
-                putSettingsRequest.setJsonEntity(Strings.toString(builder));
-            }
-            client().performRequest(putSettingsRequest);
-
-            final Request getSettingsRequest = new Request("GET", "/_cluster/settings");
-            final Response response = client().performRequest(getSettingsRequest);
-            try (XContentParser parser = createParser(JsonXContent.jsonXContent, response.getEntity().getContent())) {
-                final ClusterGetSettingsResponse clusterGetSettingsResponse = ClusterGetSettingsResponse.fromXContent(parser);
-                final Settings settings = clusterGetSettingsResponse.getPersistentSettings();
-
-                assertTrue(SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo").exists(settings));
-                assertTrue(SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo").get(settings));
-                assertTrue(SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo").exists(settings));
-                assertThat(
-                        SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo").get(settings),
-                        equalTo(Collections.singletonList("localhost:9200")));
-            }
-
-            assertSettingDeprecationsAndWarnings(new Setting<?>[]{
-                    SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo"),
-                    SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo")});
-        } else {
-            final Request getSettingsRequest = new Request("GET", "/_cluster/settings");
-            final Response getSettingsResponse = client().performRequest(getSettingsRequest);
-            try (XContentParser parser = createParser(JsonXContent.jsonXContent, getSettingsResponse.getEntity().getContent())) {
-                final ClusterGetSettingsResponse clusterGetSettingsResponse = ClusterGetSettingsResponse.fromXContent(parser);
-                final Settings settings = clusterGetSettingsResponse.getPersistentSettings();
-
-                assertFalse(SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo").exists(settings));
-                assertTrue(
-                        settings.toString(),
-                        RemoteClusterService.REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo").exists(settings));
-                assertTrue(RemoteClusterService.REMOTE_CLUSTER_SKIP_UNAVAILABLE.getConcreteSettingForNamespace("foo").get(settings));
-                assertFalse(SEARCH_REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo").exists(settings));
-                assertTrue(RemoteClusterService.REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo").exists(settings));
-                assertThat(
-                        RemoteClusterService.REMOTE_CLUSTERS_SEEDS.getConcreteSettingForNamespace("foo").get(settings),
-                        equalTo(Collections.singletonList("localhost:9200")));
-            }
-        }
-    }
-
 }

+ 1 - 9
qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/QueryBuilderBWCIT.java

@@ -20,7 +20,6 @@
 package org.elasticsearch.upgrades;
 
 import org.apache.http.util.EntityUtils;
-import org.elasticsearch.Version;
 import org.elasticsearch.client.Request;
 import org.elasticsearch.client.Response;
 import org.elasticsearch.common.Strings;
@@ -144,7 +143,6 @@ public class QueryBuilderBWCIT extends AbstractFullClusterRestartTestCase {
     }
 
     public void testQueryBuilderBWC() throws Exception {
-        final String type = getOldClusterVersion().before(Version.V_7_0_0) ? "doc" : "_doc";
         String index = "queries";
         if (isRunningAgainstOldCluster()) {
             XContentBuilder mappingsAndSettings = jsonBuilder();
@@ -157,9 +155,6 @@ public class QueryBuilderBWCIT extends AbstractFullClusterRestartTestCase {
             }
             {
                 mappingsAndSettings.startObject("mappings");
-                if (isRunningAgainstAncientCluster()) {
-                    mappingsAndSettings.startObject(type);
-                }
                 mappingsAndSettings.startObject("properties");
                 {
                     mappingsAndSettings.startObject("query");
@@ -178,9 +173,6 @@ public class QueryBuilderBWCIT extends AbstractFullClusterRestartTestCase {
                 }
                 mappingsAndSettings.endObject();
                 mappingsAndSettings.endObject();
-                if (isRunningAgainstAncientCluster()) {
-                    mappingsAndSettings.endObject();
-                }
             }
             mappingsAndSettings.endObject();
             Request request = new Request("PUT", "/" + index);
@@ -190,7 +182,7 @@ public class QueryBuilderBWCIT extends AbstractFullClusterRestartTestCase {
             assertEquals(200, rsp.getStatusLine().getStatusCode());
 
             for (int i = 0; i < CANDIDATES.size(); i++) {
-                request = new Request("PUT", "/" + index + "/" + type + "/" + Integer.toString(i));
+                request = new Request("PUT", "/" + index + "/_doc/" + Integer.toString(i));
                 request.setJsonEntity((String) CANDIDATES.get(i)[0]);
                 rsp = client().performRequest(request);
                 assertEquals(201, rsp.getStatusLine().getStatusCode());

+ 1 - 5
server/src/test/java/org/elasticsearch/index/mapper/ExternalMapper.java

@@ -24,7 +24,6 @@ import org.apache.lucene.index.Term;
 import org.apache.lucene.search.DocValuesFieldExistsQuery;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.TermQuery;
-import org.elasticsearch.Version;
 import org.elasticsearch.common.geo.builders.PointBuilder;
 import org.elasticsearch.common.collect.Iterators;
 import org.elasticsearch.common.geo.GeoPoint;
@@ -63,7 +62,6 @@ public class ExternalMapper extends FieldMapper {
         private BooleanFieldMapper.Builder boolBuilder = new BooleanFieldMapper.Builder(Names.FIELD_BOOL);
         private GeoPointFieldMapper.Builder latLonPointBuilder = new GeoPointFieldMapper.Builder(Names.FIELD_POINT);
         private GeoShapeFieldMapper.Builder shapeBuilder = new GeoShapeFieldMapper.Builder(Names.FIELD_SHAPE);
-        private LegacyGeoShapeFieldMapper.Builder legacyShapeBuilder = new LegacyGeoShapeFieldMapper.Builder(Names.FIELD_SHAPE);
         private Mapper.Builder stringBuilder;
         private String generatedValue;
         private String mapperName;
@@ -87,9 +85,7 @@ public class ExternalMapper extends FieldMapper {
             BinaryFieldMapper binMapper = binBuilder.build(context);
             BooleanFieldMapper boolMapper = boolBuilder.build(context);
             GeoPointFieldMapper pointMapper = latLonPointBuilder.build(context);
-            BaseGeoShapeFieldMapper shapeMapper = (context.indexCreatedVersion().before(Version.V_6_6_0))
-                ? legacyShapeBuilder.build(context)
-                : shapeBuilder.build(context);
+            BaseGeoShapeFieldMapper shapeMapper = shapeBuilder.build(context);
             FieldMapper stringMapper = (FieldMapper)stringBuilder.build(context);
             context.path().remove();
 

+ 0 - 64
test/framework/src/main/java/org/elasticsearch/test/rest/yaml/ClientYamlTestExecutionContext.java

@@ -40,8 +40,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER;
-
 /**
  * Execution context passed across the REST tests.
  * Holds the REST client used to communicate with elasticsearch.
@@ -98,10 +96,6 @@ public class ClientYamlTestExecutionContext {
             }
         }
 
-        if (esVersion().before(Version.V_7_0_0)) {
-            adaptRequestForOlderVersion(apiName, bodies, requestParams);
-        }
-
         HttpEntity entity = createEntity(bodies, requestHeaders);
         try {
             response = callApiInternal(apiName, requestParams, entity, requestHeaders, nodeSelector);
@@ -117,64 +111,6 @@ public class ClientYamlTestExecutionContext {
         }
     }
 
-    /**
-     * To allow tests to run against a mixed 7.x/6.x cluster, we make certain modifications to the
-     * request related to types.
-     *
-     * Specifically, we generally use typeless index creation and document writes in test set-up code.
-     * This functionality is supported in 7.x, but is not supported in 6.x (or is not the default
-     * behavior). Here we modify the request so that it will work against a 6.x node.
-     */
-    private void adaptRequestForOlderVersion(String apiName,
-                                             List<Map<String, Object>> bodies,
-                                             Map<String, String> requestParams) {
-        // For index creations, we specify 'include_type_name=false' if it is not explicitly set. This
-        // allows us to omit the parameter in the test description, while still being able to communicate
-        // with 6.x nodes where include_type_name defaults to 'true'.
-        if (apiName.equals("indices.create") && requestParams.containsKey(INCLUDE_TYPE_NAME_PARAMETER) == false) {
-            requestParams.put(INCLUDE_TYPE_NAME_PARAMETER, "false");
-        }
-
-        // We add the type to the document API requests if it's not already included.
-        if ((apiName.equals("index") || apiName.equals("update") || apiName.equals("delete") || apiName.equals("get"))
-                && requestParams.containsKey("type") == false) {
-            requestParams.put("type", "_doc");
-        }
-
-        // We also add the type to the bulk API requests if it's not already included. The type can either
-        // be on the request parameters or in the action metadata in the body of the request so we need to
-        // be sensitive to both scenarios.
-        if (apiName.equals("bulk") && requestParams.containsKey("type") == false) {
-            if (requestParams.containsKey("index")) {
-                requestParams.put("type", "_doc");
-            } else {
-                for (int i = 0; i < bodies.size(); i++) {
-                    Map<String, Object> body = bodies.get(i);
-                    Map<String, Object> actionMetadata;
-                    if (body.containsKey("index")) {
-                        actionMetadata = (Map<String, Object>) body.get("index");
-                        i++;
-                    } else if (body.containsKey("create")) {
-                        actionMetadata = (Map<String, Object>) body.get("create");
-                        i++;
-                    } else if (body.containsKey("update")) {
-                        actionMetadata = (Map<String, Object>) body.get("update");
-                        i++;
-                    } else if (body.containsKey("delete")) {
-                        actionMetadata = (Map<String, Object>) body.get("delete");
-                    } else {
-                        // action metadata is malformed so leave it malformed since
-                        // the test is probably testing for malformed action metadata
-                        continue;
-                    }
-                    if (actionMetadata.containsKey("_type") == false) {
-                        actionMetadata.put("_type", "_doc");
-                    }
-                }
-            }
-        }
-    }
-
     private HttpEntity createEntity(List<Map<String, Object>> bodies, Map<String, String> headers) throws IOException {
         if (bodies.isEmpty()) {
             return null;

+ 1 - 11
test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java

@@ -292,17 +292,7 @@ public class DoSection implements ExecutableSection {
             final boolean matches = matcher.matches();
             if (matches) {
                 final String message = matcher.group(1);
-                // noinspection StatementWithEmptyBody
-                if (masterVersion.before(Version.V_7_0_0)
-                        && message.equals("the default number of shards will change from [5] to [1] in 7.0.0; "
-                        + "if you wish to continue using the default of [5] shards, "
-                        + "you must manage this on the create index request or with an index template")) {
-                    /*
-                     * This warning header will come back in the vast majority of our tests that create an index when running against an
-                     * older master. Rather than rewrite our tests to assert this warning header, we assume that it is expected.
-                     */
-                } else // noinspection StatementWithEmptyBody
-                    if (message.startsWith("[types removal]")) {
+                if (message.startsWith("[types removal]")) {
                     /*
                      * We skip warnings related to types deprecation so that we can continue to run the many
                      * mixed-version tests that used typed APIs.

+ 0 - 4
test/framework/src/main/java/org/elasticsearch/upgrades/AbstractFullClusterRestartTestCase.java

@@ -33,10 +33,6 @@ public abstract class AbstractFullClusterRestartTestCase extends ESRestTestCase
 
     private final Version oldClusterVersion = Version.fromString(System.getProperty("tests.old_cluster_version"));
 
-    public final boolean isRunningAgainstAncientCluster() {
-        return isRunningAgainstOldCluster() && oldClusterVersion.before(Version.V_7_0_0);
-    }
-
     public final Version getOldClusterVersion() {
         return oldClusterVersion;
     }

+ 0 - 6
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestTestHelper.java

@@ -30,12 +30,6 @@ import static org.elasticsearch.test.rest.ESRestTestCase.allowTypesRemovalWarnin
 
 public final class XPackRestTestHelper {
 
-    public static final List<String> ML_PRE_V660_TEMPLATES = Collections.unmodifiableList(
-            Arrays.asList(AuditorField.NOTIFICATIONS_INDEX,
-                    MlMetaIndex.INDEX_NAME,
-                    AnomalyDetectorsIndexFields.STATE_INDEX_PREFIX,
-                    AnomalyDetectorsIndex.jobResultsIndexPrefix()));
-
     public static final List<String> ML_POST_V660_TEMPLATES = Collections.unmodifiableList(
             Arrays.asList(AuditorField.NOTIFICATIONS_INDEX,
                     MlMetaIndex.INDEX_NAME,

+ 13 - 196
x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java

@@ -16,8 +16,6 @@ import org.elasticsearch.common.xcontent.ObjectPath;
 import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.common.xcontent.support.XContentMapValues;
 import org.elasticsearch.rest.RestStatus;
-import org.elasticsearch.rest.action.document.RestGetAction;
-import org.elasticsearch.rest.action.document.RestIndexAction;
 import org.elasticsearch.rest.action.search.RestSearchAction;
 import org.elasticsearch.test.StreamsUtils;
 import org.elasticsearch.test.rest.ESRestTestCase;
@@ -28,15 +26,12 @@ import org.elasticsearch.xpack.watcher.actions.index.IndexAction;
 import org.elasticsearch.xpack.watcher.actions.logging.LoggingAction;
 import org.elasticsearch.xpack.watcher.common.text.TextTemplate;
 import org.elasticsearch.xpack.watcher.condition.InternalAlwaysCondition;
-import org.elasticsearch.xpack.watcher.support.search.WatcherSearchTemplateRequest;
 import org.elasticsearch.xpack.watcher.trigger.schedule.IntervalSchedule;
 import org.elasticsearch.xpack.watcher.trigger.schedule.ScheduleTrigger;
 import org.hamcrest.Matcher;
-import org.junit.Before;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
 import java.util.Base64;
 import java.util.List;
 import java.util.Locale;
@@ -45,9 +40,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
-import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM;
 import static org.hamcrest.Matchers.anyOf;
-import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.everyItem;
@@ -61,13 +54,6 @@ import static org.hamcrest.Matchers.startsWith;
 
 public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
 
-    private String type;
-
-    @Before
-    public void setType() {
-        type = getOldClusterVersion().before(Version.V_6_7_0) ? "doc" : "_doc";
-    }
-
     @Override
     protected Settings restClientSettings() {
         String token = "Basic " + Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8));
@@ -84,7 +70,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
      * Tests that a single document survives. Super basic smoke test.
      */
     public void testSingleDoc() throws IOException {
-        String docLocation = "/testsingledoc/" + type + "/1";
+        String docLocation = "/testsingledoc/_doc/1";
         String doc = "{\"test\": \"test\"}";
 
         if (isRunningAgainstOldCluster()) {
@@ -95,9 +81,6 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
         }
 
         Request getRequest = new Request("GET", docLocation);
-        if (getOldClusterVersion().before(Version.V_6_7_0)) {
-            getRequest.setOptions(expectWarnings(RestGetAction.TYPES_DEPRECATION_MESSAGE));
-        }
         assertThat(toStr(client().performRequest(getRequest)), containsString(doc));
     }
 
@@ -318,149 +301,6 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
         }
     }
 
-    public void testRollupIDSchemeAfterRestart() throws Exception {
-        assumeTrue("Rollup can be tested with 6.3.0 and onwards", getOldClusterVersion().onOrAfter(Version.V_6_3_0));
-        assumeTrue("Rollup ID scheme changed in 6.4", getOldClusterVersion().before(Version.V_6_4_0));
-        if (isRunningAgainstOldCluster()) {
-
-            final Request indexRequest = new Request("POST", "/id-test-rollup" + type + "/1");
-            indexRequest.setJsonEntity("{\"timestamp\":\"2018-01-01T00:00:01\",\"value\":123}");
-            client().performRequest(indexRequest);
-
-            // create the rollup job
-            final Request createRollupJobRequest = new Request("PUT", getRollupEndpoint() + "/job/rollup-id-test");
-            createRollupJobRequest.setJsonEntity("{"
-                + "\"index_pattern\":\"id-test-rollup\","
-                + "\"rollup_index\":\"id-test-results-rollup\","
-                + "\"cron\":\"*/1 * * * * ?\","
-                + "\"page_size\":100,"
-                + "\"groups\":{"
-                + "    \"date_histogram\":{"
-                + "        \"field\":\"timestamp\","
-                + "        \"interval\":\"5m\""
-                + "      },"
-                +       "\"histogram\":{"
-                + "        \"fields\": [\"value\"],"
-                + "        \"interval\":1"
-                + "      },"
-                +       "\"terms\":{"
-                + "        \"fields\": [\"value\"]"
-                + "      }"
-                + "},"
-                + "\"metrics\":["
-                + "    {\"field\":\"value\",\"metrics\":[\"min\",\"max\",\"sum\"]}"
-                + "]"
-                + "}");
-
-            Map<String, Object> createRollupJobResponse = entityAsMap(client().performRequest(createRollupJobRequest));
-            assertThat(createRollupJobResponse.get("acknowledged"), equalTo(Boolean.TRUE));
-
-            // start the rollup job
-            final Request startRollupJobRequest = new Request("POST", getRollupEndpoint() + "/job/rollup-id-test/_start");
-            Map<String, Object> startRollupJobResponse = entityAsMap(client().performRequest(startRollupJobRequest));
-            assertThat(startRollupJobResponse.get("started"), equalTo(Boolean.TRUE));
-
-            assertRollUpJob("rollup-id-test");
-
-            assertBusy(() -> {
-                client().performRequest(new Request("POST", "id-test-results-rollup/_refresh"));
-                final Request searchRequest = new Request("GET", "id-test-results-rollup/_search");
-                if (isRunningAgainstOldCluster() == false) {
-                    searchRequest.addParameter(TOTAL_HITS_AS_INT_PARAM, "true");
-                }
-                try {
-                    Map<String, Object> searchResponse = entityAsMap(client().performRequest(searchRequest));
-                    assertNotNull(ObjectPath.eval("hits.total", searchResponse));
-                    assertThat(ObjectPath.eval("hits.total", searchResponse), equalTo(1));
-                    assertThat(ObjectPath.eval("hits.hits.0._id", searchResponse), equalTo("3310683722"));
-                } catch (IOException e) {
-                    fail();
-                }
-            });
-
-            // After we've confirmed the doc, wait until we move back to STARTED so that we know the
-            // state was saved at the end
-            waitForRollUpJob("rollup-id-test", equalTo("started"));
-
-        } else {
-
-            final Request indexRequest = new Request("POST", "/id-test-rollup/" + type + "/2");
-            indexRequest.setJsonEntity("{\"timestamp\":\"2018-01-02T00:00:01\",\"value\":345}");
-            if (getOldClusterVersion().before(Version.V_6_7_0)) {
-                indexRequest.setOptions(expectWarnings(RestIndexAction.TYPES_DEPRECATION_MESSAGE));
-            }
-            client().performRequest(indexRequest);
-
-            assertRollUpJob("rollup-id-test");
-
-            // stop the rollup job to force a state save, which will upgrade the ID
-            final Request stopRollupJobRequest = new Request("POST", "/_rollup/job/rollup-id-test/_stop");
-            Map<String, Object> stopRollupJobResponse = entityAsMap(client().performRequest(stopRollupJobRequest));
-            assertThat(stopRollupJobResponse.get("stopped"), equalTo(Boolean.TRUE));
-
-            waitForRollUpJob("rollup-id-test", equalTo("stopped"));
-
-            // start the rollup job again
-            final Request startRollupJobRequest = new Request("POST", "/_rollup/job/rollup-id-test/_start");
-            Map<String, Object> startRollupJobResponse = entityAsMap(client().performRequest(startRollupJobRequest));
-            assertThat(startRollupJobResponse.get("started"), equalTo(Boolean.TRUE));
-
-            waitForRollUpJob("rollup-id-test", anyOf(equalTo("indexing"), equalTo("started")));
-
-            assertBusy(() -> {
-                client().performRequest(new Request("POST", "id-test-results-rollup/_refresh"));
-                final Request searchRequest = new Request("GET", "id-test-results-rollup/_search");
-                if (isRunningAgainstOldCluster() == false) {
-                    searchRequest.addParameter(TOTAL_HITS_AS_INT_PARAM, "true");
-                }
-                try {
-                    Map<String, Object> searchResponse = entityAsMap(client().performRequest(searchRequest));
-                    assertNotNull(ObjectPath.eval("hits.total", searchResponse));
-                    assertThat(ObjectPath.eval("hits.total", searchResponse), equalTo(2));
-                    List<String> ids = new ArrayList<>(2);
-                    ids.add(ObjectPath.eval("hits.hits.0._id", searchResponse));
-                    ids.add(ObjectPath.eval("hits.hits.1._id", searchResponse));
-
-                    // should have both old and new ID formats
-                    assertThat(ids, containsInAnyOrder("3310683722", "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA"));
-
-                    List<Double> values = new ArrayList<>(2);
-                    Map<String, Object> doc = ObjectPath.eval("hits.hits.0._source", searchResponse);
-                    values.add((Double)doc.get("value.min.value"));
-                    doc = ObjectPath.eval("hits.hits.1._source", searchResponse);
-                    values.add((Double)doc.get("value.min.value"));
-
-                    assertThat(values, containsInAnyOrder(123.0, 345.0));
-                } catch (IOException e) {
-                    fail();
-                }
-            });
-        }
-    }
-
-    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/34774")
-    public void testSqlFailsOnIndexWithTwoTypes() throws IOException {
-        // TODO this isn't going to trigger until we backport to 6.1
-        assumeTrue("It is only possible to build an index that sql doesn't like before 6.0.0",
-                getOldClusterVersion().before(Version.V_6_0_0_alpha1));
-        if (isRunningAgainstOldCluster()) {
-            Request doc1 = new Request("POST", "/testsqlfailsonindexwithtwotypes/type1");
-            doc1.setJsonEntity("{}");
-            client().performRequest(doc1);
-            Request doc2 = new Request("POST", "/testsqlfailsonindexwithtwotypes/type2");
-            doc2.setJsonEntity("{}");
-            client().performRequest(doc2);
-            return;
-        }
-        final Request sqlRequest = new Request("POST", getSQLEndpoint());
-
-        sqlRequest.setJsonEntity("{\"query\":\"SELECT * FROM testsqlfailsonindexwithtwotypes\"}");
-        ResponseException e = expectThrows(ResponseException.class, () -> client().performRequest(sqlRequest));
-        assertEquals(400, e.getResponse().getStatusLine().getStatusCode());
-        assertThat(e.getMessage(), containsString(
-            "[testsqlfailsonindexwithtwotypes] contains more than one type [type1, type2] so it is incompatible with sql"));
-    }
-
     private String loadWatch(String watch) throws IOException {
         return StreamsUtils.copyToStringFromClasspath("/org/elasticsearch/xpack/restart/" + watch);
     }
@@ -475,20 +315,11 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
     private void assertWatchIndexContentsWork() throws Exception {
         // Fetch a basic watch
         Request getRequest = new Request("GET", "_watcher/watch/bwc_watch");
-        if (getOldClusterVersion().before(Version.V_7_0_0)) {
-            getRequest.setOptions(
-                expectWarnings(
-                    IndexAction.TYPES_DEPRECATION_MESSAGE,
-                    WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE
-                )
-            );
-        } else {
-            getRequest.setOptions(
-                expectWarnings(
-                    IndexAction.TYPES_DEPRECATION_MESSAGE
-                )
-            );
-        }
+        getRequest.setOptions(
+            expectWarnings(
+                IndexAction.TYPES_DEPRECATION_MESSAGE
+            )
+        );
 
         Map<String, Object> bwcWatch = entityAsMap(client().performRequest(getRequest));
 
@@ -505,20 +336,12 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
 
         // Fetch a watch with "fun" throttle periods
         getRequest = new Request("GET", "_watcher/watch/bwc_throttle_period");
-        if (getOldClusterVersion().before(Version.V_7_0_0)) {
-            getRequest.setOptions(
-                expectWarnings(
-                    IndexAction.TYPES_DEPRECATION_MESSAGE,
-                    WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE
-                )
-            );
-        } else {
-            getRequest.setOptions(
-                expectWarnings(
-                    IndexAction.TYPES_DEPRECATION_MESSAGE
-                )
-            );
-        }
+        getRequest.setOptions(
+            expectWarnings(
+                IndexAction.TYPES_DEPRECATION_MESSAGE
+            )
+        );
+
         bwcWatch = entityAsMap(client().performRequest(getRequest));
         assertThat(bwcWatch.get("found"), equalTo(true));
         source = (Map<String, Object>) bwcWatch.get("watch");
@@ -753,12 +576,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
         for (Map<String, Object> task : rollupJobTasks) {
             if (ObjectPath.eval("id", task).equals(rollupJob)) {
                 hasRollupTask = true;
-
-                // Persistent task state field has been renamed in 6.4.0 from "status" to "state"
-                final String stateFieldName
-                    = (isRunningAgainstOldCluster() && getOldClusterVersion().before(Version.V_6_4_0)) ? "status" : "state";
-
-                final String jobStateField = "task.xpack/rollup/job." + stateFieldName + ".job_state";
+                final String jobStateField = "task.xpack/rollup/job.state.job_state";
                 assertThat("Expected field [" + jobStateField + "] to be started or indexing in " + task.get("id"),
                     ObjectPath.eval(jobStateField, task), expectedStates);
                 break;
@@ -767,7 +585,6 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
         if (hasRollupTask == false) {
             fail("Expected persistent task for [" + rollupJob + "] but none found.");
         }
-
     }
 
     private void waitForRollUpJob(final String rollupJob, final Matcher<?> expectedStates) throws Exception {

+ 0 - 13
x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlMigrationFullClusterRestartIT.java

@@ -53,13 +53,6 @@ public class MlMigrationFullClusterRestartIT extends AbstractFullClusterRestartT
     @Before
     public void waitForMlTemplates() throws Exception {
         List<String> templatesToWaitFor = XPackRestTestHelper.ML_POST_V660_TEMPLATES;
-
-        // If upgrading from a version prior to v6.6.0 the set of templates
-        // to wait for is different
-        if (isRunningAgainstOldCluster() && getOldClusterVersion().before(Version.V_6_6_0) ) {
-                templatesToWaitFor = XPackRestTestHelper.ML_PRE_V660_TEMPLATES;
-        }
-
         XPackRestTestHelper.waitForTemplates(client(), templatesToWaitFor);
     }
 
@@ -100,9 +93,6 @@ public class MlMigrationFullClusterRestartIT extends AbstractFullClusterRestartT
         client().performRequest(putClosedJob);
 
         DatafeedConfig.Builder stoppedDfBuilder = new DatafeedConfig.Builder(OLD_CLUSTER_STOPPED_DATAFEED_ID, OLD_CLUSTER_CLOSED_JOB_ID);
-        if (getOldClusterVersion().before(Version.V_6_6_0)) {
-            stoppedDfBuilder.setDelayedDataCheckConfig(null);
-        }
         stoppedDfBuilder.setIndices(Collections.singletonList("airline-data"));
 
         Request putStoppedDatafeed = new Request("PUT", "/_xpack/ml/datafeeds/" + OLD_CLUSTER_STOPPED_DATAFEED_ID);
@@ -121,9 +111,6 @@ public class MlMigrationFullClusterRestartIT extends AbstractFullClusterRestartT
         client().performRequest(openOpenJob);
 
         DatafeedConfig.Builder dfBuilder = new DatafeedConfig.Builder(OLD_CLUSTER_STARTED_DATAFEED_ID, OLD_CLUSTER_OPEN_JOB_ID);
-        if (getOldClusterVersion().before(Version.V_6_6_0)) {
-            dfBuilder.setDelayedDataCheckConfig(null);
-        }
         dfBuilder.setIndices(Collections.singletonList("airline-data"));
 
         Request putDatafeed = new Request("PUT", "_xpack/ml/datafeeds/" + OLD_CLUSTER_STARTED_DATAFEED_ID);

+ 0 - 291
x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/RollupIDUpgradeIT.java

@@ -5,297 +5,6 @@
  */
 package org.elasticsearch.upgrades;
 
-import org.elasticsearch.Version;
-import org.elasticsearch.client.Request;
-import org.elasticsearch.client.Response;
-import org.elasticsearch.common.Booleans;
-import org.elasticsearch.common.xcontent.support.XContentMapValues;
-import org.elasticsearch.rest.RestStatus;
-import org.elasticsearch.test.rest.ESRestTestCase;
-import org.elasticsearch.common.xcontent.ObjectPath;
-import org.hamcrest.Matcher;
-
-import java.io.IOException;
-import java.time.Instant;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import static org.elasticsearch.rest.action.search.RestSearchAction.TOTAL_HITS_AS_INT_PARAM;
-import static org.hamcrest.Matchers.anyOf;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.hamcrest.Matchers.equalTo;
-
-
 public class RollupIDUpgradeIT extends AbstractUpgradeTestCase {
-    private static final Version UPGRADE_FROM_VERSION =
-        Version.fromString(System.getProperty("tests.upgrade_from_version"));
-
-    /**
-     * This test verifies that as a cluster is upgraded incrementally, new documents eventually switch
-     * over to the "new" form of ID (128 bit Murmur3 ids).
-     *
-     * Rollup IDs are essentially the hashed concatenation of keys returned by the composite aggregation,
-     * so the field values that are being indexed (timestamp, value, etc) directly affect the
-     * ID that is generated.
-     *
-     * We don't know which node will get the Rollup task to start, so we don't know when it will migrate.
-     * The first doc is guaranteed to be the "old" style since all nodes are un-upgraded.  The second
-     * and third phase will have a mixed cluster, and the rollup task may or may not migrate.  In those
-     * phases we have two options (old and new) for the document added in the phase.
-     *
-     * The last phase is guaranteed to be new as it's a fully upgraded cluster.
-     */
-    public void testIDsUpgradeCorrectly() throws Exception {
-        assumeTrue("Rollup became available in 6.3", UPGRADE_FROM_VERSION.onOrAfter(Version.V_6_3_0));
-        assumeTrue("Rollup ID change happened in 6.4", UPGRADE_FROM_VERSION.before(Version.V_6_4_0));
-        switch (CLUSTER_TYPE) {
-            case OLD:
-                break;
-            case MIXED:
-                Request waitForYellow = new Request("GET", "/_cluster/health");
-                waitForYellow.addParameter("wait_for_nodes", "3");
-                waitForYellow.addParameter("wait_for_status", "yellow");
-                client().performRequest(waitForYellow);
-                break;
-            case UPGRADED:
-                Request waitForGreen = new Request("GET", "/_cluster/health/target,rollup");
-                waitForGreen.addParameter("wait_for_nodes", "3");
-                waitForGreen.addParameter("wait_for_status", "green");
-                // wait for long enough that we give delayed unassigned shards to stop being delayed
-                waitForGreen.addParameter("timeout", "70s");
-                waitForGreen.addParameter("level", "shards");
-                client().performRequest(waitForGreen);
-                break;
-            default:
-                throw new UnsupportedOperationException("Unknown cluster type [" + CLUSTER_TYPE + "]");
-        }
-
-        OffsetDateTime timestamp = Instant.parse("2018-01-01T00:00:01.000Z").atOffset(ZoneOffset.UTC);
-
-        if (CLUSTER_TYPE == ClusterType.OLD) {
-            String recoverQuickly = "{\"settings\": {\"index.unassigned.node_left.delayed_timeout\": \"100ms\"}}";
-
-            Request createTargetIndex = new Request("PUT", "/target");
-            createTargetIndex.setJsonEntity(recoverQuickly);
-            client().performRequest(createTargetIndex);
-
-            final Request indexRequest = new Request("POST", "/target/_doc/1");
-            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.toString() + "\",\"value\":123}");
-            client().performRequest(indexRequest);
-
-            // create the rollup job
-            final Request createRollupJobRequest = new Request("PUT", "/_rollup/job/rollup-id-test");
-            createRollupJobRequest.setJsonEntity("{"
-                + "\"index_pattern\":\"target\","
-                + "\"rollup_index\":\"rollup\","
-                + "\"cron\":\"*/1 * * * * ?\","
-                + "\"page_size\":100,"
-                + "\"groups\":{"
-                + "    \"date_histogram\":{"
-                + "        \"field\":\"timestamp\","
-                + "        \"interval\":\"5m\""
-                + "      },"
-                +       "\"histogram\":{"
-                + "        \"fields\": [\"value\"],"
-                + "        \"interval\":1"
-                + "      },"
-                +       "\"terms\":{"
-                + "        \"fields\": [\"value\"]"
-                + "      }"
-                + "},"
-                + "\"metrics\":["
-                + "    {\"field\":\"value\",\"metrics\":[\"min\",\"max\",\"sum\"]}"
-                + "]"
-                + "}");
-
-            Map<String, Object> createRollupJobResponse = entityAsMap(client().performRequest(createRollupJobRequest));
-            assertThat(createRollupJobResponse.get("acknowledged"), equalTo(Boolean.TRUE));
-
-            Request updateSettings = new Request("PUT", "/rollup/_settings");
-            updateSettings.setJsonEntity(recoverQuickly);
-            client().performRequest(updateSettings);
-
-            // start the rollup job
-            final Request startRollupJobRequest = new Request("POST", "_rollup/job/rollup-id-test/_start");
-            Map<String, Object> startRollupJobResponse = entityAsMap(client().performRequest(startRollupJobRequest));
-            assertThat(startRollupJobResponse.get("started"), equalTo(Boolean.TRUE));
-
-            assertRollUpJob("rollup-id-test");
-            List<String> ids = getSearchResults(1);
-            assertThat(ids, containsInAnyOrder("3310683722"));
-
-        }
-
-        if (CLUSTER_TYPE == ClusterType.MIXED && Booleans.parseBoolean(System.getProperty("tests.first_round"))) {
-            final Request indexRequest = new Request("POST", "/target/_doc/2");
-            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.plusDays(1).toString() + "\",\"value\":345}");
-            client().performRequest(indexRequest);
-
-            assertRollUpJob("rollup-id-test");
-            client().performRequest(new Request("POST", "rollup/_refresh"));
-
-            List<String> ids = getSearchResults(2);
-            // first doc, guaranteed old style
-            ids.remove("3310683722");
-
-            // next doc may be either style
-            ids.removeAll(Arrays.asList("621059582", "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA"));
-            assertThat(ids.toString(),ids.size(), equalTo(0));
-        }
-
-        if (CLUSTER_TYPE == ClusterType.MIXED && Booleans.parseBoolean(System.getProperty("tests.first_round")) == false) {
-            final Request indexRequest = new Request("POST", "/target/_doc/3");
-            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.plusDays(2).toString() + "\",\"value\":456}");
-            client().performRequest(indexRequest);
-
-            assertRollUpJob("rollup-id-test");
-            client().performRequest(new Request("POST", "rollup/_refresh"));
-
-            List<String> ids = getSearchResults(3);
-
-            // first doc, guaranteed old style
-            ids.remove("3310683722");
-
-            // next two docs may be either style
-            ids.removeAll(Arrays.asList("621059582", "4288019978",
-                "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA", "rollup-id-test$60RGDSb92YI5LH4_Fnq_1g"));
-            assertThat(ids.toString(), ids.size(), equalTo(0));
-
-        }
-
-        if (CLUSTER_TYPE == ClusterType.UPGRADED) {
-            final Request indexRequest = new Request("POST", "/target/_doc/4");
-            indexRequest.setJsonEntity("{\"timestamp\":\"" + timestamp.plusDays(3).toString() + "\",\"value\":567}");
-            client().performRequest(indexRequest);
-
-            assertRollUpJob("rollup-id-test");
-            client().performRequest(new Request("POST", "rollup/_refresh"));
-
-            List<String> ids = getSearchResults(4);
-            // first doc, guaranteed old style
-            ids.remove("3310683722");
-
-            // next two docs may be either style
-            ids.removeAll(Arrays.asList("621059582", "4288019978",
-                "rollup-id-test$ehY4NAyVSy8xxUDZrNXXIA", "rollup-id-test$60RGDSb92YI5LH4_Fnq_1g"));
-
-            // Last is guaranteed to be new
-            ids.remove("rollup-id-test$LAKZftDeQwsUtdPixrkkzQ");
-            assertThat(ids.toString(), ids.size(), equalTo(0));
-        }
-
-    }
-
-    private List<String> getSearchResults(int expectedCount) throws Exception {
-        final List<String> collectedIDs = new ArrayList<>();
-        assertBusy(() -> {
-            collectedIDs.clear();
-            client().performRequest(new Request("POST", "rollup/_refresh"));
-            final Request searchRequest = new Request("GET", "rollup/_search");
-            searchRequest.addParameter(TOTAL_HITS_AS_INT_PARAM, "true");
-            try {
-                Map<String, Object> searchResponse = entityAsMap(client().performRequest(searchRequest));
-                assertNotNull(ObjectPath.eval("hits.total", searchResponse));
-                assertThat(ObjectPath.eval("hits.total", searchResponse), equalTo(expectedCount));
-
-                for (int i = 0; i < expectedCount; i++) {
-                    String id = ObjectPath.eval("hits.hits." + i + "._id", searchResponse);
-                    collectedIDs.add(id);
-                    Map<String, Object> doc = ObjectPath.eval("hits.hits." + i + "._source", searchResponse);
-                    assertNotNull(doc);
-                    if (id.startsWith("rollup-id-test")) {
-                        assertThat(doc.get("_rollup.version"), equalTo(2));
-                    } else {
-                        assertThat(doc.get("_rollup.version"), equalTo(1));
-                    }
-                }
-            } catch (IOException e) {
-                fail();
-            }
-        });
-        return collectedIDs;
-    }
-
-    @SuppressWarnings("unchecked")
-    private void assertRollUpJob(final String rollupJob) throws Exception {
-        final Matcher<?> expectedStates = anyOf(equalTo("indexing"), equalTo("started"));
-        waitForRollUpJob(rollupJob, expectedStates);
-
-        // check that the rollup job is started using the RollUp API
-        final Request getRollupJobRequest = new Request("GET", "_rollup/job/" + rollupJob);
-        Map<String, Object> getRollupJobResponse = entityAsMap(client().performRequest(getRollupJobRequest));
-        Map<String, Object> job = getJob(getRollupJobResponse, rollupJob);
-        if (job != null) {
-            assertThat(ObjectPath.eval("status.job_state", job), expectedStates);
-        }
-
-        // check that the rollup job is started using the Tasks API
-        final Request taskRequest = new Request("GET", "_tasks");
-        taskRequest.addParameter("detailed", "true");
-        taskRequest.addParameter("actions", "xpack/rollup/*");
-        Map<String, Object> taskResponse = entityAsMap(client().performRequest(taskRequest));
-        Map<String, Object> taskResponseNodes = (Map<String, Object>) taskResponse.get("nodes");
-        Map<String, Object> taskResponseNode = (Map<String, Object>) taskResponseNodes.values().iterator().next();
-        Map<String, Object> taskResponseTasks = (Map<String, Object>) taskResponseNode.get("tasks");
-        Map<String, Object> taskResponseStatus = (Map<String, Object>) taskResponseTasks.values().iterator().next();
-        assertThat(ObjectPath.eval("status.job_state", taskResponseStatus), expectedStates);
-
-        // check that the rollup job is started using the Cluster State API
-        final Request clusterStateRequest = new Request("GET", "_cluster/state/metadata");
-        Map<String, Object> clusterStateResponse = entityAsMap(client().performRequest(clusterStateRequest));
-        List<Map<String, Object>> rollupJobTasks = ObjectPath.eval("metadata.persistent_tasks.tasks", clusterStateResponse);
-
-        boolean hasRollupTask = false;
-        for (Map<String, Object> task : rollupJobTasks) {
-            if (ObjectPath.eval("id", task).equals(rollupJob)) {
-                hasRollupTask = true;
-                break;
-            }
-        }
-        if (hasRollupTask == false) {
-            fail("Expected persistent task for [" + rollupJob + "] but none found.");
-        }
-
-    }
-
-    private void waitForRollUpJob(final String rollupJob, final Matcher<?> expectedStates) throws Exception {
-        assertBusy(() -> {
-            final Request getRollupJobRequest = new Request("GET", "_rollup/job/" + rollupJob);
-            Response getRollupJobResponse = client().performRequest(getRollupJobRequest);
-            assertThat(getRollupJobResponse.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));
-
-            Map<String, Object> job = getJob(getRollupJobResponse, rollupJob);
-            if (job != null) {
-                assertThat(ObjectPath.eval("status.job_state", job), expectedStates);
-            }
-        }, 30L, TimeUnit.SECONDS);
-    }
-
-    private static Map<String, Object> getJob(Response response, String targetJobId) throws IOException {
-        return getJob(ESRestTestCase.entityAsMap(response), targetJobId);
-    }
-
-    @SuppressWarnings("unchecked")
-    private static Map<String, Object> getJob(Map<String, Object> jobsMap, String targetJobId) throws IOException {
-
-        List<Map<String, Object>> jobs =
-            (List<Map<String, Object>>) XContentMapValues.extractValue("jobs", jobsMap);
-
-        if (jobs == null) {
-            return null;
-        }
 
-        for (Map<String, Object> job : jobs) {
-            String jobId = (String) ((Map<String, Object>) job.get("config")).get("id");
-            if (jobId.equals(targetJobId)) {
-                return job;
-            }
-        }
-        return null;
-    }
 }