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.
This commit is contained in:
parent
7761154e83
commit
02debfd127
|
@ -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();
|
||||
File file = new File(path, "elasticsearch-" + version);
|
||||
if (!file.exists()) {
|
||||
throw new IllegalArgumentException("Backwards tests location is missing: " + file.getAbsolutePath());
|
||||
}
|
||||
});
|
||||
if (subdirs == null || subdirs.length == 0) {
|
||||
throw new IllegalArgumentException("Backwards dir " + path + " must be a directory, and contain elasticsearch releases");
|
||||
if (!file.isDirectory()) {
|
||||
throw new IllegalArgumentException("Backwards tests location is not a directory: " + file.getAbsolutePath());
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
|
|
Loading…
Reference in New Issue