From 7edea63ce2af72707dbb97fe5cee8806bf35b498 Mon Sep 17 00:00:00 2001 From: Nicholas Walter Knize Date: Wed, 2 Nov 2022 09:05:34 -0500 Subject: [PATCH] improve legibility of removed v1 constant Signed-off-by: Nicholas Walter Knize --- .../java/org/opensearch/transport/InboundDecoderTests.java | 2 +- .../src/main/java/org/opensearch/test/VersionUtils.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/opensearch/transport/InboundDecoderTests.java b/server/src/test/java/org/opensearch/transport/InboundDecoderTests.java index ab444cfacb598..c156a2d1570f8 100644 --- a/server/src/test/java/org/opensearch/transport/InboundDecoderTests.java +++ b/server/src/test/java/org/opensearch/transport/InboundDecoderTests.java @@ -326,7 +326,7 @@ public void testEnsureVersionCompatibility() throws IOException { ise = InboundDecoder.ensureVersionCompatibility(Version.V_2_0_0, version, true); assertNull(ise); - ise = InboundDecoder.ensureVersionCompatibility(Version.fromId(1000099), version, false); + ise = InboundDecoder.ensureVersionCompatibility(VersionUtils.V_1_0_0, version, false); assertEquals( "Received message from unsupported version: [1.0.0] minimal compatible version is: [" + version.minimumCompatibilityVersion() diff --git a/test/framework/src/main/java/org/opensearch/test/VersionUtils.java b/test/framework/src/main/java/org/opensearch/test/VersionUtils.java index e7f8ff33c39c6..8fb9bc5cd7c1c 100644 --- a/test/framework/src/main/java/org/opensearch/test/VersionUtils.java +++ b/test/framework/src/main/java/org/opensearch/test/VersionUtils.java @@ -49,6 +49,9 @@ /** Utilities for selecting versions in tests */ public class VersionUtils { + // version 1.0 is removed; this is used purely to retain consistent logic for migrations + @Deprecated + public static Version V_1_0_0 = Version.fromId(1000099 ^ Version.MASK); /** * Sort versions that have backwards compatibility guarantees from @@ -104,7 +107,7 @@ static Tuple, List> resolveReleasedVersions(Version curre // remove last minor unless it's the first OpenSearch version. // all Legacy ES versions are released, so we don't exclude any. - if (current.equals(Version.fromId(1000099 ^ Version.MASK)) == false) { + if (current.equals(V_1_0_0) == false) { List lastMinorLine = stableVersions.get(stableVersions.size() - 1); if (lastMinorLine.get(lastMinorLine.size() - 1) instanceof LegacyESVersion == false) { // if the last minor line is Legacy there are no more staged releases; do nothing