Merge pull request #13443 from rjernst/simplify_bwc_path

Move static bwc indexes to a shared location
This commit is contained in:
Ryan Ernst 2015-09-10 10:31:50 -07:00
commit 47de1bd923
108 changed files with 15 additions and 19 deletions

View File

@ -98,8 +98,7 @@ public class OldIndexBackwardsCompatibilityIT extends ESIntegTestCase {
private List<String> loadIndexesList(String prefix) throws IOException {
List<String> indexes = new ArrayList<>();
Path dir = getDataPath(".");
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, prefix + "-*.zip")) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(getBwcIndicesPath(), prefix + "-*.zip")) {
for (Path path : stream) {
indexes.add(path.getFileName().toString());
}

View File

@ -62,12 +62,12 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
// Configure using path.repo
return settingsBuilder()
.put(super.nodeSettings(nodeOrdinal))
.put("path.repo", reposRoot())
.put("path.repo", getBwcIndicesPath())
.build();
} else {
// Configure using url white list
try {
URI repoJarPatternUri = new URI("jar:" + reposRoot().toUri().toString() + "*.zip!/repo/");
URI repoJarPatternUri = new URI("jar:" + getBwcIndicesPath().toUri().toString() + "*.zip!/repo/");
return settingsBuilder()
.put(super.nodeSettings(nodeOrdinal))
.putArray("repositories.url.allowed_urls", repoJarPatternUri.toString())
@ -128,10 +128,6 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
}
}
private Path reposRoot() {
return getDataPath(".");
}
private List<String> repoVersions() throws Exception {
return listRepoVersions("repo");
}
@ -142,7 +138,7 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
private List<String> listRepoVersions(String prefix) throws Exception {
List<String> repoVersions = new ArrayList<>();
Path repoFiles = reposRoot();
Path repoFiles = getBwcIndicesPath();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(repoFiles, prefix + "-*.zip")) {
for (Path entry : stream) {
String fileName = entry.getFileName().toString();
@ -155,8 +151,8 @@ public class RestoreBackwardsCompatIT extends AbstractSnapshotIntegTestCase {
}
private void createRepo(String prefix, String version, String repo) throws Exception {
String repoFile = prefix + "-" + version + ".zip";
URI repoFileUri = getDataPath(repoFile).toUri();
Path repoFile = getBwcIndicesPath().resolve(prefix + "-" + version + ".zip");
URI repoFileUri = repoFile.toUri();
URI repoJarUri = new URI("jar:" + repoFileUri.toString() + "!/repo/");
logger.info("--> creating repository [{}] for version [{}]", repo, version);
assertAcked(client().admin().cluster().preparePutRepository(repo)

View File

@ -141,8 +141,7 @@ public class MultiDataPathUpgraderTests extends ESTestCase {
*/
public void testUpgradeRealIndex() throws IOException, URISyntaxException {
List<Path> indexes = new ArrayList<>();
Path dir = getDataPath("/" + OldIndexBackwardsCompatibilityIT.class.getPackage().getName().replace('.', '/')); // the files are in the same pkg as the OldIndexBackwardsCompatibilityTests test
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "index-*.zip")) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(getBwcIndicesPath(), "index-*.zip")) {
for (Path path : stream) {
indexes.add(path);
}

View File

@ -1786,8 +1786,7 @@ public class InternalEngineTests extends ESTestCase {
public void testUpgradeOldIndex() throws IOException {
List<Path> indexes = new ArrayList<>();
Path dir = getDataPath("/" + OldIndexBackwardsCompatibilityIT.class.getPackage().getName().replace('.', '/')); // the files are in the same pkg as the OldIndexBackwardsCompatibilityTests test
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "index-*.zip")) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(getBwcIndicesPath(), "index-*.zip")) {
for (Path path : stream) {
indexes.add(path);
}

View File

@ -1157,8 +1157,7 @@ public class TranslogTests extends ESTestCase {
public void testUpgradeOldTranslogFiles() throws IOException {
List<Path> indexes = new ArrayList<>();
Path dir = getDataPath("/" + OldIndexBackwardsCompatibilityIT.class.getPackage().getName().replace('.', '/')); // the files are in the same pkg as the OldIndexBackwardsCompatibilityTests test
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "index-*.zip")) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(getBwcIndicesPath(), "index-*.zip")) {
for (Path path : stream) {
indexes.add(path);
}

View File

@ -488,6 +488,10 @@ public abstract class ESTestCase extends LuceneTestCase {
}
}
public Path getBwcIndicesPath() {
return getDataPath("/indices/bwc");
}
/** Returns a random number of temporary paths. */
public String[] tmpPaths() {
final int numPaths = TestUtil.nextInt(random(), 1, 3);

Some files were not shown because too many files have changed in this diff Show More