diff --git a/core/src/main/java/org/elasticsearch/Version.java b/core/src/main/java/org/elasticsearch/Version.java index a476a84abcc..bb4897282fb 100644 --- a/core/src/main/java/org/elasticsearch/Version.java +++ b/core/src/main/java/org/elasticsearch/Version.java @@ -256,7 +256,9 @@ public class Version { public static final Version V_1_7_3 = new Version(V_1_7_3_ID, true, org.apache.lucene.util.Version.LUCENE_4_10_4); public static final int V_2_0_0_beta1_ID = 2000001; - public static final Version V_2_0_0_beta1 = new Version(V_2_0_0_beta1_ID, true, org.apache.lucene.util.Version.LUCENE_5_2_1); + public static final Version V_2_0_0_beta1 = new Version(V_2_0_0_beta1_ID, false, org.apache.lucene.util.Version.LUCENE_5_2_1); + public static final int V_2_0_0_beta2_ID = 2000002; + public static final Version V_2_0_0_beta2 = new Version(V_2_0_0_beta2_ID, false, org.apache.lucene.util.Version.LUCENE_5_2_1); public static final int V_2_0_0_ID = 2000099; public static final Version V_2_0_0 = new Version(V_2_0_0_ID, true, org.apache.lucene.util.Version.LUCENE_5_2_1); public static final int V_2_1_0_ID = 2010099; @@ -281,6 +283,8 @@ public class Version { return V_2_1_0; case V_2_0_0_ID: return V_2_0_0; + case V_2_0_0_beta2_ID: + return V_2_0_0_beta2; case V_2_0_0_beta1_ID: return V_2_0_0_beta1; case V_1_7_3_ID: diff --git a/core/src/test/java/org/elasticsearch/VersionTests.java b/core/src/test/java/org/elasticsearch/VersionTests.java index 76c0d8d19d3..3adb6d98c0c 100644 --- a/core/src/test/java/org/elasticsearch/VersionTests.java +++ b/core/src/test/java/org/elasticsearch/VersionTests.java @@ -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 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); diff --git a/core/src/test/resources/indices/bwc/index-2.0.0-beta1.zip b/core/src/test/resources/indices/bwc/index-2.0.0-beta1.zip new file mode 100644 index 00000000000..c0054fd3740 Binary files /dev/null and b/core/src/test/resources/indices/bwc/index-2.0.0-beta1.zip differ diff --git a/core/src/test/resources/indices/bwc/index-2.0.0-beta2.zip b/core/src/test/resources/indices/bwc/index-2.0.0-beta2.zip new file mode 100644 index 00000000000..169a0b71d75 Binary files /dev/null and b/core/src/test/resources/indices/bwc/index-2.0.0-beta2.zip differ diff --git a/core/src/test/resources/indices/bwc/repo-2.0.0-beta1.zip b/core/src/test/resources/indices/bwc/repo-2.0.0-beta1.zip new file mode 100644 index 00000000000..f57314c601c Binary files /dev/null and b/core/src/test/resources/indices/bwc/repo-2.0.0-beta1.zip differ diff --git a/core/src/test/resources/indices/bwc/repo-2.0.0-beta2.zip b/core/src/test/resources/indices/bwc/repo-2.0.0-beta2.zip new file mode 100644 index 00000000000..1eb19f1d61e Binary files /dev/null and b/core/src/test/resources/indices/bwc/repo-2.0.0-beta2.zip differ