From 02debfd1279e64326b5ddd9b3c3cfac9770df8c2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 31 Oct 2014 19:09:38 -0700 Subject: [PATCH] Tests: Remove accidentally added bwc behavior for auto choosing a version. An early version of #7966 had the ability to choose a bwc version automatically, but this was removed before the change was committed. However, the change was not removed from the ongoing work in #7922 and it made it in unknowningly. --- ...csearchBackwardsCompatIntegrationTest.java | 45 ++++--------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java index 4cc394c5fc4..6b973c81084 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchBackwardsCompatIntegrationTest.java @@ -34,7 +34,6 @@ import org.junit.Before; import org.junit.Ignore; import java.io.File; -import java.io.FileFilter; import java.io.IOException; import static org.hamcrest.Matchers.is; @@ -83,50 +82,24 @@ public abstract class ElasticsearchBackwardsCompatIntegrationTest extends Elasti private static File backwardsCompatibilityPath() { String path = System.getProperty(TESTS_BACKWARDS_COMPATIBILITY_PATH); if (path == null || path.isEmpty()) { - throw new IllegalArgumentException("Invalid Backwards tests location path:" + path); + throw new IllegalArgumentException("Must specify backwards test path with property " + TESTS_BACKWARDS_COMPATIBILITY_PATH); } String version = System.getProperty(TESTS_BACKWARDS_COMPATIBILITY_VERSION); if (version == null || version.isEmpty()) { - throw new IllegalArgumentException("Invalid Backwards tests version:" + version); + throw new IllegalArgumentException("Must specify backwards test version with property " + TESTS_BACKWARDS_COMPATIBILITY_VERSION); } if (Version.fromString(version).before(Version.CURRENT.minimumCompatibilityVersion())) { throw new IllegalArgumentException("Backcompat elasticsearch version must be same major version as current. " + "backcompat: " + version + ", current: " + Version.CURRENT.toString()); } - File dir; - if (version == null || version.isEmpty()) { - // choose a random version - // TODO: how can we put the version selected in the repeat test output? - File[] subdirs = new File(path).listFiles(new FileFilter() { - @Override - public boolean accept(File file) { - return file.getName().startsWith("elasticsearch-") && file.isDirectory(); - } - }); - if (subdirs == null || subdirs.length == 0) { - throw new IllegalArgumentException("Backwards dir " + path + " must be a directory, and contain elasticsearch releases"); - } - dir = subdirs[randomInt(subdirs.length - 1)]; - version = dir.getName().substring("elasticsearch-".length()); - } else { - dir = new File(path, "elasticsearch-" + version); - if (!dir.exists()) { - throw new IllegalArgumentException("Backwards tests location is missing: " + dir.getAbsolutePath()); - } - if (!dir.isDirectory()) { - throw new IllegalArgumentException("Backwards tests location is not a directory: " + dir.getAbsolutePath()); - } + File file = new File(path, "elasticsearch-" + version); + if (!file.exists()) { + throw new IllegalArgumentException("Backwards tests location is missing: " + file.getAbsolutePath()); + } + if (!file.isDirectory()) { + throw new IllegalArgumentException("Backwards tests location is not a directory: " + file.getAbsolutePath()); } - - Version v = Version.fromString(version); - if (v == null) { - throw new IllegalArgumentException("Backcompat elasticsearch version could not be parsed: " + version); - } - if (v.major != Version.CURRENT.major) { - throw new IllegalArgumentException("Backcompat elasticsearch version must be same major version as current. " + - "backcompat: " + version + ", current: " + Version.CURRENT.toString()); - } - return dir; + return file; } public CompositeTestCluster backwardsCluster() {