Use Version.compareMajor instead of using equals operator (#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>
This commit is contained in:
Rabi Panda 2022-01-10 17:59:08 -08:00 committed by GitHub
parent c192ecdfec
commit 28f688fbc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ public class JoinTaskExecutorTests extends OpenSearchTestCase {
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));