Skip to content

Commit 72efee2

Browse files
authored
Fix FullClusterRestartIT BwC tests (#103092)
1 parent 99a840e commit 72efee2

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

test/framework/src/main/java/org/elasticsearch/cluster/metadata/DataStreamTestHelper.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package org.elasticsearch.cluster.metadata;
99

1010
import org.apache.lucene.tests.util.LuceneTestCase;
11-
import org.elasticsearch.Version;
1211
import org.elasticsearch.action.admin.indices.rollover.MetadataRolloverService;
1312
import org.elasticsearch.cluster.ClusterName;
1413
import org.elasticsearch.cluster.ClusterState;
@@ -82,7 +81,6 @@
8281

8382
public final class DataStreamTestHelper {
8483

85-
private static final Version DATE_IN_BACKING_INDEX_VERSION = Version.V_7_11_0;
8684
private static final Settings.Builder SETTINGS = ESTestCase.settings(IndexVersion.current()).put("index.hidden", true);
8785
private static final int NUMBER_OF_SHARDS = 1;
8886
private static final int NUMBER_OF_REPLICAS = 1;

test/framework/src/main/java/org/elasticsearch/test/rest/RestTestLegacyFeatures.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ public class RestTestLegacyFeatures implements FeatureSpecification {
5454
public static final NodeFeature TRANSFORM_NEW_API_ENDPOINT = new NodeFeature("transform.new_api_endpoint");
5555
// Ref: https://github.com/elastic/elasticsearch/pull/65205
5656
@UpdateForV9
57-
public static final NodeFeature DATA_STREAMS_DATE_IN_INDEX_NAME = new NodeFeature("data-streams.date_in_index_name");
58-
@UpdateForV9
5957
public static final NodeFeature ML_INDICES_HIDDEN = new NodeFeature("ml.indices_hidden");
6058
@UpdateForV9
6159
public static final NodeFeature ML_ANALYTICS_MAPPINGS = new NodeFeature("ml.analytics_mappings");
62-
@UpdateForV9
63-
public static final NodeFeature SLM_SUPPORTED = new NodeFeature("slm.supported");
6460

6561
@Override
6662
public Map<NodeFeature, Version> getHistoricalFeatures() {
@@ -78,10 +74,8 @@ public Map<NodeFeature, Version> getHistoricalFeatures() {
7874
entry(SECURITY_ROLE_DESCRIPTORS_OPTIONAL, Version.V_7_3_0),
7975
entry(SEARCH_AGGREGATIONS_FORCE_INTERVAL_SELECTION_DATE_HISTOGRAM, Version.V_7_2_0),
8076
entry(TRANSFORM_NEW_API_ENDPOINT, Version.V_7_5_0),
81-
entry(DATA_STREAMS_DATE_IN_INDEX_NAME, Version.V_7_11_0),
8277
entry(ML_INDICES_HIDDEN, Version.V_7_7_0),
83-
entry(ML_ANALYTICS_MAPPINGS, Version.V_7_3_0),
84-
entry(SLM_SUPPORTED, Version.V_7_4_0)
78+
entry(ML_ANALYTICS_MAPPINGS, Version.V_7_3_0)
8579
);
8680
}
8781
}

x-pack/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ public void testTransformLegacyTemplateCleanup() throws Exception {
586586
}
587587

588588
public void testSlmPolicyAndStats() throws IOException {
589+
@UpdateForV9
590+
var originalClusterSupportsSlm = parseLegacyVersion(getOldClusterVersion()).map(v -> v.onOrAfter(Version.V_7_4_0)).orElse(true);
591+
589592
SnapshotLifecyclePolicy slmPolicy = new SnapshotLifecyclePolicy(
590593
"test-policy",
591594
"test-policy",
@@ -594,7 +597,7 @@ public void testSlmPolicyAndStats() throws IOException {
594597
Collections.singletonMap("indices", Collections.singletonList("*")),
595598
null
596599
);
597-
if (isRunningAgainstOldCluster() && clusterHasFeature(RestTestLegacyFeatures.SLM_SUPPORTED)) {
600+
if (isRunningAgainstOldCluster() && originalClusterSupportsSlm) {
598601
Request createRepoRequest = new Request("PUT", "_snapshot/test-repo");
599602
String repoCreateJson = "{" + " \"type\": \"fs\"," + " \"settings\": {" + " \"location\": \"test-repo\"" + " }" + "}";
600603
createRepoRequest.setJsonEntity(repoCreateJson);
@@ -608,7 +611,7 @@ public void testSlmPolicyAndStats() throws IOException {
608611
client().performRequest(createSlmPolicyRequest);
609612
}
610613

611-
if (isRunningAgainstOldCluster() == false && clusterHasFeature(RestTestLegacyFeatures.SLM_SUPPORTED)) {
614+
if (isRunningAgainstOldCluster() == false && originalClusterSupportsSlm) {
612615
Request getSlmPolicyRequest = new Request("GET", "_slm/policy/test-policy");
613616
Response response = client().performRequest(getSlmPolicyRequest);
614617
Map<String, Object> responseMap = entityAsMap(response);
@@ -940,6 +943,10 @@ public void testDataStreams() throws Exception {
940943
var originalClusterSupportsDataStreams = parseLegacyVersion(getOldClusterVersion()).map(v -> v.onOrAfter(Version.V_7_9_0))
941944
.orElse(true);
942945

946+
@UpdateForV9
947+
var originalClusterDataStreamHasDateInIndexName = parseLegacyVersion(getOldClusterVersion()).map(v -> v.onOrAfter(Version.V_7_11_0))
948+
.orElse(true);
949+
943950
assumeTrue("no data streams in versions before 7.9.0", originalClusterSupportsDataStreams);
944951
if (isRunningAgainstOldCluster()) {
945952
createComposableTemplate(client(), "dst", "ds");
@@ -977,12 +984,7 @@ public void testDataStreams() throws Exception {
977984
assertEquals("ds", ds.get("name"));
978985
assertEquals(1, indices.size());
979986
assertEquals(
980-
DataStreamTestHelper.getLegacyDefaultBackingIndexName(
981-
"ds",
982-
1,
983-
timestamp,
984-
clusterHasFeature(RestTestLegacyFeatures.DATA_STREAMS_DATE_IN_INDEX_NAME)
985-
),
987+
DataStreamTestHelper.getLegacyDefaultBackingIndexName("ds", 1, timestamp, originalClusterDataStreamHasDateInIndexName),
986988
indices.get(0).get("index_name")
987989
);
988990
assertNumHits("ds", 1, 1);

0 commit comments

Comments
 (0)