Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
package org.opensearch.tools.cli.plugin;

import org.apache.lucene.tests.util.LuceneTestCase;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.MockTerminal;
Expand Down Expand Up @@ -271,7 +270,7 @@ public void testExistingIncompatiblePlugin() throws Exception {
"version",
"1.0",
"opensearch.version",
LegacyESVersion.fromString("5.0.0").toString(),
Version.fromString("5.0.0").toString(),
"java.version",
System.getProperty("java.specification.version"),
"classname",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.cluster.node;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.Booleans;
import org.opensearch.common.annotation.PublicApi;
Expand Down Expand Up @@ -349,11 +348,7 @@ public void validateRole(List<DiscoveryNodeRole> roles) {
* The version that {@link #REMOTE_CLUSTER_CLIENT_ROLE} is introduced. Nodes before this version do not have that role even
* they can connect to remote clusters.
*/
public static final Version REMOTE_CLUSTER_CLIENT_ROLE_VERSION = LegacyESVersion.fromString("7.8.0");

static SortedSet<DiscoveryNodeRole> LEGACY_ROLES = Collections.unmodifiableSortedSet(
new TreeSet<>(Arrays.asList(DATA_ROLE, INGEST_ROLE, MASTER_ROLE))
);
public static final Version REMOTE_CLUSTER_CLIENT_ROLE_VERSION = Version.fromString("7.8.0");

/**
* Represents an unknown role. This can occur if a newer version adds a role that an older version does not know about, or a newer
Expand Down
6 changes: 3 additions & 3 deletions server/src/test/java/org/opensearch/VersionTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testVersionComparison() {

public void testMin() {
assertEquals(VersionUtils.getPreviousVersion(), Version.min(Version.CURRENT, VersionUtils.getPreviousVersion()));
assertEquals(LegacyESVersion.fromString("7.0.1"), Version.min(LegacyESVersion.fromString("7.0.1"), Version.CURRENT));
assertEquals(Version.fromString("7.0.1"), Version.min(Version.fromString("7.0.1"), Version.CURRENT));
Version version = VersionUtils.randomVersion(random());
Version version1 = VersionUtils.randomVersion(random());
if (version.id <= version1.id) {
Expand Down Expand Up @@ -189,12 +189,12 @@ public void testIndexCreatedVersion() {
}

public void testMinCompatVersion() {
Version major = LegacyESVersion.fromString("6.8.0");
Version major = Version.fromString("6.8.0");
assertThat(Version.fromString("1.0.0").minimumCompatibilityVersion(), equalTo(major));
assertThat(Version.fromString("1.2.0").minimumCompatibilityVersion(), equalTo(major));
assertThat(Version.fromString("1.3.0").minimumCompatibilityVersion(), equalTo(major));

Version major2x = LegacyESVersion.fromString("7.10.0");
Version major2x = Version.fromString("7.10.0");
assertThat(Version.fromString("2.0.0").minimumCompatibilityVersion(), equalTo(major2x));
assertThat(Version.fromString("2.2.0").minimumCompatibilityVersion(), equalTo(major2x));
assertThat(Version.fromString("2.3.0").minimumCompatibilityVersion(), equalTo(major2x));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

package org.opensearch.cluster.coordination;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.cluster.ClusterName;
import org.opensearch.cluster.ClusterState;
Expand Down Expand Up @@ -137,7 +136,7 @@ public void testPreventJoinClusterWithUnsupportedNodeVersions() {
final DiscoveryNode tooLowJoiningNode = new DiscoveryNode(
UUIDs.base64UUID(),
buildNewFakeTransportAddress(),
LegacyESVersion.fromString("6.7.0")
Version.fromString("6.7.0")
);
expectThrows(IllegalStateException.class, () -> {
if (randomBoolean()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

package org.opensearch.cluster.metadata;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.settings.IndexScopedSettings;
import org.opensearch.common.settings.Settings;
Expand Down Expand Up @@ -131,7 +130,7 @@ public void testFailUpgrade() {
minCompat,
Version.max(minCompat, VersionUtils.getPreviousVersion(Version.CURRENT))
);
Version indexCreated = LegacyESVersion.fromString((minCompat.major - 1) + "." + randomInt(5) + "." + randomInt(5));
Version indexCreated = Version.fromString((minCompat.major - 1) + "." + randomInt(5) + "." + randomInt(5));
final IndexMetadata metadata = newIndexMeta(
"foo",
Settings.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import com.carrotsearch.randomizedtesting.generators.RandomPicks;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.settings.Setting;
Expand Down Expand Up @@ -493,7 +492,7 @@ public void testMaxMinNodeVersion() {
buildNewFakeTransportAddress(),
Collections.emptyMap(),
new HashSet<>(randomSubsetOf(DiscoveryNodeRole.BUILT_IN_ROLES)),
LegacyESVersion.fromString("5.1.0")
Version.fromString("5.1.0")
)
);
discoBuilder.add(
Expand All @@ -503,7 +502,7 @@ public void testMaxMinNodeVersion() {
buildNewFakeTransportAddress(),
Collections.emptyMap(),
new HashSet<>(randomSubsetOf(DiscoveryNodeRole.BUILT_IN_ROLES)),
LegacyESVersion.fromString("6.3.0")
Version.fromString("6.3.0")
)
);
discoBuilder.add(
Expand All @@ -520,7 +519,7 @@ public void testMaxMinNodeVersion() {
discoBuilder.clusterManagerNodeId("name_2");
DiscoveryNodes build = discoBuilder.build();
assertEquals(Version.fromString("1.1.0"), build.getMaxNodeVersion());
assertEquals(LegacyESVersion.fromString("5.1.0"), build.getMinNodeVersion());
assertEquals(Version.fromString("5.1.0"), build.getMinNodeVersion());
}

private DiscoveryNode buildDiscoveryNodeFromExisting(DiscoveryNode existing, Version newVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.lucene.Lucene;
import org.opensearch.common.lucene.index.OpenSearchDirectoryReader;
Expand Down Expand Up @@ -220,7 +219,7 @@ public void testLuceneVersionOnUnknownVersions() {
assertEquals(VersionUtils.getPreviousVersion(Version.fromString("2.1.3")).luceneVersion, version.luceneVersion);

// too old version, major should be the oldest supported lucene version minus 1
version = LegacyESVersion.fromString("5.2.1");
version = Version.fromString("5.2.1");
assertEquals(VersionUtils.getFirstVersion().luceneVersion.major - 1, version.luceneVersion.major);

// future version, should be the same version as today
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.apache.lucene.util.CollectionUtil;
import org.apache.lucene.util.Constants;
import org.opensearch.ExceptionsHelper;
import org.opensearch.LegacyESVersion;
import org.opensearch.OpenSearchException;
import org.opensearch.Version;
import org.opensearch.action.ActionListenerResponseHandler;
Expand Down Expand Up @@ -2199,7 +2198,7 @@ public void testTimeoutPerConnection() throws IOException {

public void testHandshakeWithIncompatVersion() {
assumeTrue("only tcp transport has a handshake method", serviceA.getOriginalTransport() instanceof TcpTransport);
Version version = LegacyESVersion.fromString("6.0.0");
Version version = Version.fromString("6.0.0");
try (MockTransportService service = buildService("TS_C", version, Settings.EMPTY)) {
service.start();
service.acceptIncomingRequests();
Expand All @@ -2225,14 +2224,7 @@ public void testHandshakeUpdatesVersion() throws IOException {
service.start();
service.acceptIncomingRequests();
TransportAddress address = service.boundAddress().publishAddress();
DiscoveryNode node = new DiscoveryNode(
"TS_TPC",
"TS_TPC",
address,
emptyMap(),
emptySet(),
LegacyESVersion.fromString("2.0.0")
);
DiscoveryNode node = new DiscoveryNode("TS_TPC", "TS_TPC", address, emptyMap(), emptySet(), Version.fromString("2.0.0"));
ConnectionProfile.Builder builder = new ConnectionProfile.Builder();
builder.addConnections(
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.test.rest.yaml.section;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.xcontent.yaml.YamlXContent;
import org.opensearch.core.common.ParsingException;
import org.opensearch.core.xcontent.XContentParser;
Expand Down Expand Up @@ -130,8 +130,8 @@ public void testParseTestSectionWithDoSetAndSkipSectionsNoSkip() throws Exceptio
assertThat(testSection, notNullValue());
assertThat(testSection.getName(), equalTo("First test section"));
assertThat(testSection.getSkipSection(), notNullValue());
assertThat(testSection.getSkipSection().getLowerVersion(), equalTo(LegacyESVersion.fromString("6.0.0")));
assertThat(testSection.getSkipSection().getUpperVersion(), equalTo(LegacyESVersion.fromString("6.2.0")));
assertThat(testSection.getSkipSection().getLowerVersion(), equalTo(Version.fromString("6.0.0")));
assertThat(testSection.getSkipSection().getUpperVersion(), equalTo(Version.fromString("6.2.0")));
assertThat(testSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259"));
assertThat(testSection.getExecutableSections().size(), equalTo(2));
DoSection doSection = (DoSection) testSection.getExecutableSections().get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

package org.opensearch.test.rest.yaml.section;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.xcontent.yaml.YamlXContent;

import java.io.IOException;
Expand Down Expand Up @@ -135,8 +135,8 @@ public void testParseSetupAndSkipSectionNoSkip() throws Exception {
assertThat(setupSection, notNullValue());
assertThat(setupSection.getSkipSection().isEmpty(), equalTo(false));
assertThat(setupSection.getSkipSection(), notNullValue());
assertThat(setupSection.getSkipSection().getLowerVersion(), equalTo(LegacyESVersion.fromString("6.0.0")));
assertThat(setupSection.getSkipSection().getUpperVersion(), equalTo(LegacyESVersion.fromString("6.3.0")));
assertThat(setupSection.getSkipSection().getLowerVersion(), equalTo(Version.fromString("6.0.0")));
assertThat(setupSection.getSkipSection().getUpperVersion(), equalTo(Version.fromString("6.3.0")));
assertThat(setupSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259"));
assertThat(setupSection.getExecutableSections().size(), equalTo(2));
assertThat(setupSection.getExecutableSections().get(0), instanceOf(DoSection.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

package org.opensearch.test.rest.yaml.section;

import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.xcontent.yaml.YamlXContent;
import org.opensearch.core.common.ParsingException;
Expand Down Expand Up @@ -72,7 +71,7 @@ public void testSkip() {
"foobar"
);
assertFalse(section.skip(Version.CURRENT));
assertTrue(section.skip(LegacyESVersion.fromString("6.0.0")));
assertTrue(section.skip(Version.fromString("6.0.0")));
section = new SkipSection(randomBoolean() ? null : "6.0.0 - 6.1.0", Collections.singletonList("boom"), "foobar");
assertTrue(section.skip(Version.CURRENT));
}
Expand Down
Loading