Skip to content

Commit

Permalink
Use Version.compareMajor instead of using equals operator (opensearch…
Browse files Browse the repository at this point in the history
…-project#1876)

This test fails due to equality check of majors between OpenSearch Version 1.x and LegacyESVersion 7.x. They should be equivalent but in this case the check fails and LegacyVersion.v6.8.x is chosen which was removed in 52508d5.

This change fixes the comparison logic by using `Version.compareMajor` method instead.

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
  • Loading branch information
adnapibar authored Jan 11, 2022
1 parent c192ecd commit 28f688f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void testPreventJoinClusterWithUnsupportedNodeVersions() {
expectThrows(IllegalStateException.class, () -> JoinTaskExecutor.ensureMajorVersionBarrier(oldMajor, minNodeVersion));
}

final Version minGoodVersion = maxNodeVersion.major == minNodeVersion.major ?
final Version minGoodVersion = maxNodeVersion.compareMajor(minNodeVersion) == 0 ?
// we have to stick with the same major
minNodeVersion : maxNodeVersion.minimumCompatibilityVersion();
final Version justGood = randomVersionBetween(random(), minGoodVersion, maxCompatibleVersion(minNodeVersion));
Expand Down

0 comments on commit 28f688f

Please sign in to comment.