Remove workaround for V2_0_0_beta1 in VersionTests
This commit is contained in:
parent
f20473a2e4
commit
312bf5a011
|
@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.is;
|
|||
import static org.hamcrest.Matchers.sameInstance;
|
||||
|
||||
public class VersionTests extends ESTestCase {
|
||||
|
||||
|
||||
public void testMavenVersion() {
|
||||
// maven sets this property to ensure that the latest version
|
||||
// we use here is the version that is actually set to the project.version
|
||||
|
@ -49,7 +49,7 @@ public class VersionTests extends ESTestCase {
|
|||
assumeTrue("tests.version is set", property != null);
|
||||
assertEquals(property, Version.CURRENT.toString());
|
||||
}
|
||||
|
||||
|
||||
public void testVersionComparison() throws Exception {
|
||||
assertThat(V_0_20_0.before(V_0_90_0), is(true));
|
||||
assertThat(V_0_20_0.before(V_0_20_0), is(false));
|
||||
|
@ -67,7 +67,7 @@ public class VersionTests extends ESTestCase {
|
|||
assertThat(V_0_20_0.onOrAfter(V_0_20_0), is(true));
|
||||
assertThat(V_0_90_0.onOrAfter(V_0_20_0), is(true));
|
||||
}
|
||||
|
||||
|
||||
public void testVersionConstantPresent() {
|
||||
assertThat(Version.CURRENT, sameInstance(Version.fromId(Version.CURRENT.id)));
|
||||
assertThat(Version.CURRENT.luceneVersion, equalTo(org.apache.lucene.util.Version.LATEST));
|
||||
|
@ -88,7 +88,7 @@ public class VersionTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testVersionFromString() {
|
||||
final int iters = scaledRandomIntBetween(100, 1000);
|
||||
for (int i = 0; i < iters; i++) {
|
||||
|
@ -127,7 +127,7 @@ public class VersionTests extends ESTestCase {
|
|||
final Version version = randomFrom(Version.V_0_18_0, Version.V_0_90_13, Version.V_1_3_0);
|
||||
assertEquals(version, Version.indexCreated(Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, "foo").put(IndexMetaData.SETTING_VERSION_CREATED, version).build()));
|
||||
}
|
||||
|
||||
|
||||
public void testMinCompatVersion() {
|
||||
assertThat(Version.V_2_0_0_beta1.minimumCompatibilityVersion(), equalTo(Version.V_2_0_0_beta1));
|
||||
assertThat(Version.V_1_3_0.minimumCompatibilityVersion(), equalTo(Version.V_1_0_0));
|
||||
|
@ -148,7 +148,7 @@ public class VersionTests extends ESTestCase {
|
|||
assertTrue(Version.V_1_4_0_Beta1.isBeta());
|
||||
assertFalse(Version.V_1_4_0.isBeta());
|
||||
}
|
||||
|
||||
|
||||
public void testParseVersion() {
|
||||
final int iters = scaledRandomIntBetween(100, 1000);
|
||||
for (int i = 0; i < iters; i++) {
|
||||
|
@ -161,7 +161,7 @@ public class VersionTests extends ESTestCase {
|
|||
assertEquals(version.snapshot(), parsedVersion.snapshot());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testParseLenient() {
|
||||
// note this is just a silly sanity check, we test it in lucene
|
||||
for (Version version : VersionUtils.allVersions()) {
|
||||
|
@ -171,7 +171,7 @@ public class VersionTests extends ESTestCase {
|
|||
assertThat(luceneVersion, Matchers.equalTo(Lucene.parseVersionLenient(string, null)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void testAllVersionsMatchId() throws Exception {
|
||||
Map<String, Version> maxBranchVersions = new HashMap<>();
|
||||
for (java.lang.reflect.Field field : Version.class.getDeclaredFields()) {
|
||||
|
@ -179,12 +179,12 @@ public class VersionTests extends ESTestCase {
|
|||
assertTrue(field.getName() + " should be static", Modifier.isStatic(field.getModifiers()));
|
||||
assertTrue(field.getName() + " should be final", Modifier.isFinal(field.getModifiers()));
|
||||
int versionId = (Integer)field.get(Version.class);
|
||||
|
||||
|
||||
String constantName = field.getName().substring(0, field.getName().length() - 3);
|
||||
java.lang.reflect.Field versionConstant = Version.class.getField(constantName);
|
||||
assertTrue(constantName + " should be static", Modifier.isStatic(versionConstant.getModifiers()));
|
||||
assertTrue(constantName + " should be final", Modifier.isFinal(versionConstant.getModifiers()));
|
||||
|
||||
|
||||
Version v = (Version) versionConstant.get(Version.class);
|
||||
logger.info("Checking " + v);
|
||||
assertEquals("Version id " + field.getName() + " does not point to " + constantName, v, Version.fromId(versionId));
|
||||
|
@ -200,13 +200,9 @@ public class VersionTests extends ESTestCase {
|
|||
} else {
|
||||
assertEquals("V_" + v.number().replace('.', '_'), constantName);
|
||||
}
|
||||
|
||||
|
||||
// only the latest version for a branch should be a snapshot (ie unreleased)
|
||||
String branchName = "" + v.major + "." + v.minor;
|
||||
if (v.equals(Version.V_2_0_0_beta1)) {
|
||||
assertTrue("Remove this once beta1 is released", v.snapshot());
|
||||
continue; // this is just a temporary fix until we have a snapshot for the beta since we now have 2 unreleased version of the same major.minor group
|
||||
}
|
||||
Version maxBranchVersion = maxBranchVersions.get(branchName);
|
||||
if (maxBranchVersion == null) {
|
||||
maxBranchVersions.put(branchName, v);
|
||||
|
|
Loading…
Reference in New Issue