From 7ea012db244b55d9b1e89df81498b7b67ad539ed Mon Sep 17 00:00:00 2001 From: Rabi Panda Date: Tue, 11 Jan 2022 00:48:31 +0000 Subject: [PATCH] Use Version.compareMajor instead of using equals operator 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 --- .../opensearch/cluster/coordination/JoinTaskExecutorTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/test/java/org/opensearch/cluster/coordination/JoinTaskExecutorTests.java b/server/src/test/java/org/opensearch/cluster/coordination/JoinTaskExecutorTests.java index ec93475635419..a019235c99743 100644 --- a/server/src/test/java/org/opensearch/cluster/coordination/JoinTaskExecutorTests.java +++ b/server/src/test/java/org/opensearch/cluster/coordination/JoinTaskExecutorTests.java @@ -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));