From 99eb2327e3de391a6639c0cf0abbb6d8922c51bd Mon Sep 17 00:00:00 2001 From: David Roberts Date: Mon, 25 Sep 2023 19:26:35 +0100 Subject: [PATCH] Test fallout --- .../core/common/validation/SourceDestValidator.java | 3 ++- .../xpack/core/transform/TransformConfigVersion.java | 2 +- .../RemoteClusterMinimumVersionValidationTests.java | 8 ++++---- .../transform/transforms/TransformConfigTests.java | 10 +++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/common/validation/SourceDestValidator.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/common/validation/SourceDestValidator.java index 4392b868cabb7..9adb668265151 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/common/validation/SourceDestValidator.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/common/validation/SourceDestValidator.java @@ -71,7 +71,8 @@ public final class SourceDestValidator { + "alias [{0}], license is not active"; public static final String REMOTE_SOURCE_INDICES_NOT_SUPPORTED = "remote source indices are not supported"; public static final String REMOTE_CLUSTERS_TOO_OLD = - "remote clusters are expected to run at least version [{0}] (reason: [{1}]), but the following clusters were too old: [{2}]"; + "remote clusters are expected to run at least transport version [{0}] (reason: [{1}])," + + " but the following clusters were too old: [{2}]"; public static final String PIPELINE_MISSING = "Pipeline with id [{0}] could not be found"; private final IndexNameExpressionResolver indexNameExpressionResolver; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformConfigVersion.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformConfigVersion.java index 71dfd40e641c4..acc10008cd40f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformConfigVersion.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/TransformConfigVersion.java @@ -311,7 +311,7 @@ public static TransformConfigVersion fromVersion(Version version) { } return fromId(version.id); } - + public static TransformConfigVersion getMinTransformConfigVersion(DiscoveryNodes nodes) { return getMinMaxTransformConfigVersion(nodes).v1(); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/common/validation/RemoteClusterMinimumVersionValidationTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/common/validation/RemoteClusterMinimumVersionValidationTests.java index 5143ab52247b7..57166d996d124 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/common/validation/RemoteClusterMinimumVersionValidationTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/common/validation/RemoteClusterMinimumVersionValidationTests.java @@ -82,8 +82,8 @@ public void testValidate_OneRemoteClusterVersionTooLow() { ctx -> assertThat( ctx.getValidationException().validationErrors(), contains( - "remote clusters are expected to run at least version [7.11.0] (reason: [some reason]), " - + "but the following clusters were too old: [cluster-A (7.10.2)]" + "remote clusters are expected to run at least transport version [7110099] (reason: [some reason]), " + + "but the following clusters were too old: [cluster-A (7100099)]" ) ) ) @@ -100,8 +100,8 @@ public void testValidate_TwoRemoteClusterVersionsTooLow() { ctx -> assertThat( ctx.getValidationException().validationErrors(), contains( - "remote clusters are expected to run at least version [7.11.2] (reason: [some reason]), " - + "but the following clusters were too old: [cluster-A (7.10.2), cluster-B (7.11.0)]" + "remote clusters are expected to run at least transport version [7120099] (reason: [some reason]), " + + "but the following clusters were too old: [cluster-A (7100099), cluster-B (7110099)]" ) ) ) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java index 840fb912751e2..ba2cd0ba04312 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java @@ -7,7 +7,7 @@ package org.elasticsearch.xpack.core.transform.transforms; -import org.elasticsearch.Version; +import org.elasticsearch.TransportVersions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.BytesStreamOutput; @@ -603,7 +603,7 @@ public void testRewriteForUpdate() throws IOException { "max_page_search_size": 111 }, "version": "%s" - }""", Version.V_7_6_0.toString()); + }""", TransformConfigVersion.V_7_6_0.toString()); TransformConfig transformConfig = createTransformConfigFromString(pivotTransform, "body_id", true); TransformConfig transformConfigRewritten = TransformConfig.rewriteForUpdate(transformConfig); @@ -645,7 +645,7 @@ public void testRewriteForUpdateAlignCheckpoints() throws IOException { } }, "version": "%s" - }""", Version.V_7_12_0.toString()); + }""", TransformConfigVersion.V_7_12_0.toString()); TransformConfig transformConfig = createTransformConfigFromString(pivotTransform, "body_id", true); TransformConfig transformConfigRewritten = TransformConfig.rewriteForUpdate(transformConfig); @@ -693,7 +693,7 @@ public void testRewriteForUpdateMaxPageSizeSearchConflicting() throws IOExceptio "max_page_search_size": 555 }, "version": "%s" - }""", Version.V_7_5_0.toString()); + }""", TransformConfigVersion.V_7_5_0.toString()); TransformConfig transformConfig = createTransformConfigFromString(pivotTransform, "body_id", true); TransformConfig transformConfigRewritten = TransformConfig.rewriteForUpdate(transformConfig); @@ -828,7 +828,7 @@ public void testGetAdditionalSourceDestValidations_WithRuntimeMappings() throws assertThat(additiionalValidations.get(0), is(instanceOf(RemoteClusterMinimumVersionValidation.class))); RemoteClusterMinimumVersionValidation remoteClusterMinimumVersionValidation = (RemoteClusterMinimumVersionValidation) additiionalValidations.get(0); - assertThat(remoteClusterMinimumVersionValidation.getMinExpectedTransportVersion(), is(equalTo(Version.V_7_12_0))); + assertThat(remoteClusterMinimumVersionValidation.getMinExpectedTransportVersion(), is(equalTo(TransportVersions.V_7_12_0))); assertThat(remoteClusterMinimumVersionValidation.getReason(), is(equalTo("source.runtime_mappings field was set"))); }