diff --git a/server/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java b/server/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java deleted file mode 100644 index cd1a133643339..0000000000000 --- a/server/src/test/java/org/elasticsearch/bwcompat/RestoreBackwardsCompatIT.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.bwcompat; - -import org.elasticsearch.common.io.FileTestUtils; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.env.Environment; -import org.elasticsearch.repositories.fs.FsRepository; -import org.elasticsearch.snapshots.AbstractSnapshotIntegTestCase; -import org.elasticsearch.snapshots.SnapshotRestoreException; -import org.elasticsearch.snapshots.mockstore.MockRepository; -import org.elasticsearch.test.ESIntegTestCase.ClusterScope; -import org.elasticsearch.test.ESIntegTestCase.Scope; -import org.junit.BeforeClass; - -import java.io.IOException; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.greaterThan; - -/** - * Tests that restoring from a very old snapshot fails appropriately. - */ -@ClusterScope(scope = Scope.TEST) -public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase { - - private static Path repoPath; - - @Override - protected Settings nodeSettings(int nodeOrdinal) { - return Settings.builder() - .put(super.nodeSettings(nodeOrdinal)) - .put(Environment.PATH_REPO_SETTING.getKey(), repoPath) - .build(); - } - - @BeforeClass - public static void repoSetup() throws IOException { - repoPath = createTempDir("repositories"); - } - - public void testRestoreUnsupportedSnapshots() throws Exception { - String repo = "test_repo"; - String snapshot = "test_1"; - List repoVersions = unsupportedRepoVersions(); - assertThat(repoVersions.size(), greaterThan(0)); - for (String version : repoVersions) { - createRepo("unsupportedrepo", version, repo); - assertUnsupportedIndexFailsToRestore(repo, snapshot); - } - } - - private List unsupportedRepoVersions() throws Exception { - return listRepoVersions("unsupportedrepo"); - } - - private List listRepoVersions(String prefix) throws Exception { - List repoVersions = new ArrayList<>(); - Path repoFiles = getBwcIndicesPath(); - try (DirectoryStream stream = Files.newDirectoryStream(repoFiles, prefix + "-*.zip")) { - for (Path entry : stream) { - String fileName = entry.getFileName().toString(); - String version = fileName.substring(prefix.length() + 1); - version = version.substring(0, version.length() - ".zip".length()); - repoVersions.add(version); - } - } - return repoVersions; - } - - private void createRepo(String prefix, String version, String repo) throws Exception { - Path repoFileFromBuild = getBwcIndicesPath().resolve(prefix + "-" + version + ".zip"); - String repoFileName = repoFileFromBuild.getFileName().toString().split(".zip")[0]; - Path fsRepoPath = repoPath.resolve(repoFileName); - FileTestUtils.unzip(repoFileFromBuild, fsRepoPath, null); - logger.info("--> creating repository [{}] for version [{}]", repo, version); - assertAcked(client().admin().cluster().preparePutRepository(repo) - .setType(MockRepository.TYPE).setSettings(Settings.builder() - .put(FsRepository.REPOSITORIES_LOCATION_SETTING.getKey(), fsRepoPath.getParent().relativize(fsRepoPath).resolve("repo").toString()))); - } - - private void assertUnsupportedIndexFailsToRestore(String repo, String snapshot) throws IOException { - logger.info("--> restoring unsupported snapshot"); - try { - client().admin().cluster().prepareRestoreSnapshot(repo, snapshot).setRestoreGlobalState(true).setWaitForCompletion(true).get(); - fail("should have failed to restore - " + repo); - } catch (SnapshotRestoreException ex) { - assertThat(ex.getMessage(), containsString("snapshot does not exist")); - } - } -} - diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-0.20.6.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-0.20.6.zip deleted file mode 100644 index fab2f20fe62d2..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-0.20.6.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.Beta2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.Beta2.zip deleted file mode 100644 index 020f6f4e59fd8..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.Beta2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.RC1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.RC1.zip deleted file mode 100644 index a84c50759a7d9..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.RC1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.RC2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.RC2.zip deleted file mode 100644 index e5d65ebaf499f..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.RC2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.zip deleted file mode 100644 index 13f778d965b77..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.1.zip deleted file mode 100644 index 76ed278fade3f..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.2.zip deleted file mode 100644 index 762eabf828648..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.3.zip deleted file mode 100644 index ba79dea3459bf..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.0.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.0.zip deleted file mode 100644 index cbf84c717ac2a..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.1.zip deleted file mode 100644 index 00ea0447b2619..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.2.zip deleted file mode 100644 index 18abd996259b2..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.1.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.0.zip deleted file mode 100644 index f5e62a1a94b52..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.1.zip deleted file mode 100644 index 935e71b0c1262..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.2.zip deleted file mode 100644 index d69b22a0887f7..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.3.zip deleted file mode 100644 index 295f9f758cc39..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.4.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.4.zip deleted file mode 100644 index e9efc00c97f36..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.2.4.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.0.zip deleted file mode 100644 index 5a59e21930d91..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.1.zip deleted file mode 100644 index 2ae1d7c0ad3e9..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.2.zip deleted file mode 100644 index c67b99717a5ff..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.3.zip deleted file mode 100644 index 64e3235142dc1..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.4.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.4.zip deleted file mode 100644 index 55e67445549c4..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.4.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.5.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.5.zip deleted file mode 100644 index 35a5fd4836c3b..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.5.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.6.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.6.zip deleted file mode 100644 index f1eb21ca4b0d6..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.6.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.7.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.7.zip deleted file mode 100644 index 543c13c2ba223..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.7.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.8.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.8.zip deleted file mode 100644 index 93abac386f9aa..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.8.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.9.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.9.zip deleted file mode 100644 index 7dc194df58e2f..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.3.9.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.0.Beta1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.0.Beta1.zip deleted file mode 100644 index 5adf788623f81..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.0.Beta1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.0.zip deleted file mode 100644 index 21f867c85ead3..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.1.zip deleted file mode 100644 index 18166eabbd97b..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.2.zip deleted file mode 100644 index f03625a1ce16b..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.3.zip deleted file mode 100644 index d78fbb1975bbb..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.4.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.4.zip deleted file mode 100644 index 1e8944618ea4d..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.4.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.5.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.5.zip deleted file mode 100644 index fcae43982ae11..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.4.5.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.0.zip deleted file mode 100644 index a55e6c4c3537b..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.1.zip deleted file mode 100644 index 7cccbbe25a9ab..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.2.zip deleted file mode 100644 index cee5783e10aa9..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.5.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.0.zip deleted file mode 100644 index 1c31a0240be12..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.1.zip deleted file mode 100644 index 746f3ce613c89..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.2.zip deleted file mode 100644 index de4c5be79289a..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.6.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.0.zip deleted file mode 100644 index 893689b0f4ce8..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.1.zip deleted file mode 100644 index cd5c6c07c9823..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.2.zip deleted file mode 100644 index a0daaac39d442..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.3.zip deleted file mode 100644 index 12e13dafc5973..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.4.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.4.zip deleted file mode 100644 index 86be302153bd2..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.4.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.5.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.5.zip deleted file mode 100644 index 46bada25ced85..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-1.7.5.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-beta1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-beta1.zip deleted file mode 100644 index b32f2a48d7478..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-beta1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-beta2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-beta2.zip deleted file mode 100644 index 2b2663a42012e..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-beta2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-rc1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-rc1.zip deleted file mode 100644 index 59b31f5cc3b97..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0-rc1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0.zip deleted file mode 100644 index ae6668be1cf59..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.1.zip deleted file mode 100644 index c675125226c47..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.2.zip deleted file mode 100644 index 2e1062c294b6d..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.0.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.0.zip deleted file mode 100644 index fdaf6321421d6..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.1.zip deleted file mode 100644 index e29cf4016289d..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.2.zip deleted file mode 100644 index f1c371720c5fb..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.1.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.0.zip deleted file mode 100644 index 1501c1942ade6..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.1.zip deleted file mode 100644 index 93e39514c3cd5..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.2.zip deleted file mode 100644 index 5c937a3c6c145..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.2.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.0.zip deleted file mode 100644 index 575232e09df15..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.1.zip deleted file mode 100644 index f0434a446f034..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.2.zip deleted file mode 100644 index c5ca8a3432527..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.3.zip deleted file mode 100644 index 4310f8e1efb8f..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.4.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.4.zip deleted file mode 100644 index 6abccc237b67e..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.4.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.5.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.5.zip deleted file mode 100644 index f80ed069180de..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.3.5.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.0.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.0.zip deleted file mode 100644 index 09591e1d7ed1d..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.0.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.1.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.1.zip deleted file mode 100644 index 2c88ecebe3178..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.1.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.2.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.2.zip deleted file mode 100644 index d2f250c8a90e0..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.2.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.3.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.3.zip deleted file mode 100644 index c1ce2d9fbbb56..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.3.zip and /dev/null differ diff --git a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.5.zip b/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.5.zip deleted file mode 100644 index ec1effccc35be..0000000000000 Binary files a/server/src/test/resources/indices/bwc/unsupportedrepo-2.4.5.zip and /dev/null differ diff --git a/test/framework/src/main/java/org/elasticsearch/common/io/FileTestUtils.java b/test/framework/src/main/java/org/elasticsearch/common/io/FileTestUtils.java deleted file mode 100644 index 4128c9d9efc88..0000000000000 --- a/test/framework/src/main/java/org/elasticsearch/common/io/FileTestUtils.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.common.io; - -import org.elasticsearch.common.Nullable; -import org.junit.Assert; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFileExists; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; - -/** test helper methods for working with files */ -public class FileTestUtils { - - /** - * Check that a file contains a given String - * @param dir root dir for file - * @param filename relative path from root dir to file - * @param expected expected content (if null, we don't expect any file) - */ - public static void assertFileContent(Path dir, String filename, String expected) throws IOException { - Assert.assertThat(Files.exists(dir), is(true)); - Path file = dir.resolve(filename); - if (expected == null) { - Assert.assertThat("file [" + file + "] should not exist.", Files.exists(file), is(false)); - } else { - assertFileExists(file); - String fileContent = new String(Files.readAllBytes(file), java.nio.charset.StandardCharsets.UTF_8); - // trim the string content to prevent different handling on windows vs. unix and CR chars... - Assert.assertThat(fileContent.trim(), equalTo(expected.trim())); - } - } - - /** - * Unzip a zip file to a destination directory. If the zip file does not exist, an IOException is thrown. - * If the destination directory does not exist, it will be created. - * - * @param zip zip file to unzip - * @param destDir directory to unzip the file to - * @param prefixToRemove the (optional) prefix in the zip file path to remove when writing to the destination directory - * @throws IOException if zip file does not exist, or there was an error reading from the zip file or - * writing to the destination directory - */ - public static void unzip(final Path zip, final Path destDir, @Nullable final String prefixToRemove) throws IOException { - if (Files.notExists(zip)) { - throw new IOException("[" + zip + "] zip file must exist"); - } - Files.createDirectories(destDir); - - try (ZipInputStream zipInput = new ZipInputStream(Files.newInputStream(zip))) { - ZipEntry entry; - while ((entry = zipInput.getNextEntry()) != null) { - final String entryPath; - if (prefixToRemove != null) { - if (entry.getName().startsWith(prefixToRemove)) { - entryPath = entry.getName().substring(prefixToRemove.length()); - } else { - throw new IOException("prefix not found: " + prefixToRemove); - } - } else { - entryPath = entry.getName(); - } - final Path path = Paths.get(destDir.toString(), entryPath); - if (entry.isDirectory()) { - Files.createDirectories(path); - } else { - Files.copy(zipInput, path); - } - zipInput.closeEntry(); - } - } - } -}