[TEST] Fix compatibilty tests for wire compatibility based on Version.java

This commit is contained in:
Simon Willnauer 2017-05-18 10:44:26 +02:00
parent b19537cae6
commit 831c497638
2 changed files with 16 additions and 4 deletions

View File

@ -278,9 +278,12 @@ public class Version implements Comparable<Version> {
public Version minimumCompatibilityVersion() {
final int bwcMajor;
final int bwcMinor;
if (this.onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {
bwcMajor = major - 1;
bwcMinor = 4;
if (major == 6) { // we only specialize for current major here
bwcMajor = Version.V_5_4_0.major;
bwcMinor = Version.V_5_4_0.minor;
} else if (major > 6) { // all the future versions are compatible with first minor...
bwcMajor = major -1;
bwcMinor = 0;
} else {
bwcMajor = major;
bwcMinor = 0;

View File

@ -293,7 +293,6 @@ public class VersionTests extends ESTestCase {
if (maxBranchVersion == null) {
maxBranchVersions.put(branchName, v);
} else if (v.after(maxBranchVersion)) {
assertFalse("Version " + maxBranchVersion + " cannot be a snapshot because version " + v + " exists", VersionUtils.isSnapshot(maxBranchVersion));
maxBranchVersions.put(branchName, v);
}
@ -329,6 +328,16 @@ public class VersionTests extends ESTestCase {
assertTrue(isCompatible(Version.V_5_5_0_UNRELEASED, Version.V_6_0_0_alpha2_UNRELEASED));
assertFalse(isCompatible(Version.fromId(2000099), Version.V_6_0_0_alpha2_UNRELEASED));
assertFalse(isCompatible(Version.fromId(2000099), Version.V_5_0_0));
assertTrue(isCompatible(Version.fromString("6.0.0"), Version.fromString("7.0.0")));
if (Version.CURRENT.isRelease()) {
assertTrue(isCompatible(Version.CURRENT, Version.fromString("7.0.0")));
} else {
assertFalse(isCompatible(Version.CURRENT, Version.fromString("7.0.0")));
}
assertFalse("only compatible with the latest minor",
isCompatible(VersionUtils.getPreviousMinorVersion(), Version.fromString("7.0.0")));
assertFalse(isCompatible(Version.V_5_0_0, Version.fromString("6.0.0")));
assertFalse(isCompatible(Version.V_5_0_0, Version.fromString("7.0.0")));
}