From 50a635a4c78d0caf2bd908b575c1320ad9a0a981 Mon Sep 17 00:00:00 2001 From: Jordan Powers Date: Thu, 25 Sep 2025 16:23:05 -0700 Subject: [PATCH 1/5] Move nodeFeature checks to beforeUpgrade --- .../upgrades/ParameterizedRollingUpgradeTestCase.java | 4 ++++ .../elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java | 5 ++--- .../upgrades/LogsdbIndexingRollingUpgradeIT.java | 5 ++--- .../upgrades/MatchOnlyTextRollingUpgradeIT.java | 5 ++--- .../elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java | 5 ++--- .../upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java | 5 ++--- .../upgrades/SyntheticSourceRollingUpgradeIT.java | 5 ++--- .../org/elasticsearch/upgrades/TextRollingUpgradeIT.java | 5 ++--- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java b/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java index 43a9081964483..12ebe6141b8ed 100644 --- a/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java +++ b/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java @@ -54,6 +54,8 @@ public static Iterable parameters() { protected abstract ElasticsearchCluster getUpgradeCluster(); + protected void beforeUpgrade() {} + @Before public void upgradeNode() throws Exception { // extract old cluster features @@ -96,6 +98,8 @@ public void upgradeNode() throws Exception { // Skip remaining tests if upgrade failed assumeFalse("Cluster upgrade failed", upgradeFailed); + beforeUpgrade(); + // finally, upgrade node if (upgradedNodes.size() < requestedUpgradedNodes) { closeClients(); diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java index ebeaf84aba7be..a7e0df072ba5c 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java @@ -13,7 +13,6 @@ import org.elasticsearch.Build; import org.elasticsearch.client.Request; -import org.junit.Before; import java.io.IOException; import java.time.Instant; @@ -31,8 +30,8 @@ public LogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java index 5cf20d7254b85..f332e78a37f05 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java @@ -21,7 +21,6 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.test.rest.ObjectPath; import org.elasticsearch.xcontent.XContentType; -import org.junit.Before; import java.io.IOException; import java.io.InputStream; @@ -76,8 +75,8 @@ public LogsdbIndexingRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) super(upgradedNodes); } - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java index 88209e9b04fef..259477a16b486 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java @@ -22,7 +22,6 @@ import org.elasticsearch.index.mapper.MapperFeatures; import org.elasticsearch.test.rest.ObjectPath; import org.elasticsearch.xcontent.XContentType; -import org.junit.Before; import java.io.IOException; import java.io.InputStream; @@ -92,8 +91,8 @@ public MatchOnlyTextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java index 053b0f0ce4b7a..74bb22e982a19 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java @@ -12,7 +12,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; import org.elasticsearch.Build; -import org.junit.Before; import java.time.Instant; import java.util.Map; @@ -29,8 +28,8 @@ public NoLogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java index dbaac0124fc3c..9916717ad7b04 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java @@ -25,7 +25,6 @@ import org.elasticsearch.test.cluster.local.distribution.DistributionType; import org.hamcrest.Matcher; import org.hamcrest.Matchers; -import org.junit.Before; import org.junit.ClassRule; import java.io.IOException; @@ -116,8 +115,8 @@ protected Settings restClientSettings() { } }"""; - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java index f48e5305a74b3..b801a74e19b91 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java @@ -15,7 +15,6 @@ import org.elasticsearch.client.Request; import org.elasticsearch.test.rest.ObjectPath; import org.hamcrest.Matchers; -import org.junit.Before; import java.time.Instant; import java.util.Arrays; @@ -72,8 +71,8 @@ public SyntheticSourceRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) super(upgradedNodes); } - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java index 942140935963c..44aecaa708944 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java @@ -19,7 +19,6 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.test.rest.ObjectPath; import org.elasticsearch.xcontent.XContentType; -import org.junit.Before; import java.io.IOException; import java.io.InputStream; @@ -89,8 +88,8 @@ public TextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Before - public void checkFeatures() { + @Override + protected void beforeUpgrade() { if (Build.current().isSnapshot()) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } From a4edaf670e52c24a70667807a2e5533e97c56596 Mon Sep 17 00:00:00 2001 From: Jordan Powers Date: Thu, 25 Sep 2025 16:24:38 -0700 Subject: [PATCH 2/5] Unmute tests --- muted-tests.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index f6852802c351d..c2f90a94fafca 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -627,18 +627,9 @@ tests: - class: org.elasticsearch.upgrades.SearchableSnapshotsRollingUpgradeIT method: testBlobStoreCacheWithFullCopyInMixedVersions issue: https://github.com/elastic/elasticsearch/issues/135474 -- class: org.elasticsearch.upgrades.SyntheticSourceRollingUpgradeIT - method: testIndexing {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135338 - class: org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT method: test issue: https://github.com/elastic/elasticsearch/issues/134407 -- class: org.elasticsearch.upgrades.LogsUsageRollingUpgradeIT - method: testUsage {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135312 -- class: org.elasticsearch.upgrades.NoLogsUsageRollingUpgradeIT - method: testUsage {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135316 # Examples: # From 0c6bb8ba463c5e0147e90ebc3b608ab08fc04f63 Mon Sep 17 00:00:00 2001 From: Jordan Powers Date: Fri, 26 Sep 2025 07:51:37 -0700 Subject: [PATCH 3/5] Unmute more tests --- muted-tests.yml | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 7e0489121f28d..a424729876815 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -621,48 +621,6 @@ tests: - class: org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT method: test issue: https://github.com/elastic/elasticsearch/issues/134407 -- class: org.elasticsearch.upgrades.LogsUsageRollingUpgradeIT - method: testUsage {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135312 -- class: org.elasticsearch.upgrades.NoLogsUsageRollingUpgradeIT - method: testUsage {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135316 -- class: org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT - method: testIndexing {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135320 -- class: org.elasticsearch.upgrades.TextRollingUpgradeIT - method: testIndexing {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135237 -- class: org.elasticsearch.upgrades.StandardToLogsDbIndexModeRollingUpgradeIT - method: testLogsIndexing {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135315 -- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT - method: testIndexing {upgradedNodes=3} - issue: https://github.com/elastic/elasticsearch/issues/135324 -- class: org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT - method: testIndexing {upgradedNodes=2} - issue: https://github.com/elastic/elasticsearch/issues/135327 -- class: org.elasticsearch.upgrades.TextRollingUpgradeIT - method: testIndexing {upgradedNodes=2} - issue: https://github.com/elastic/elasticsearch/issues/135238 -- class: org.elasticsearch.upgrades.TextRollingUpgradeIT - method: testIndexing {upgradedNodes=1} - issue: https://github.com/elastic/elasticsearch/issues/135236 -- class: org.elasticsearch.upgrades.SyntheticSourceRollingUpgradeIT - method: testIndexing {upgradedNodes=2} - issue: https://github.com/elastic/elasticsearch/issues/135344 -- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT - method: testIndexing {upgradedNodes=2} - issue: https://github.com/elastic/elasticsearch/issues/135325 -- class: org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT - method: testIndexing {upgradedNodes=1} - issue: https://github.com/elastic/elasticsearch/issues/135511 -- class: org.elasticsearch.upgrades.SyntheticSourceRollingUpgradeIT - method: testIndexing {upgradedNodes=1} - issue: https://github.com/elastic/elasticsearch/issues/135512 -- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT - method: testIndexing {upgradedNodes=1} - issue: https://github.com/elastic/elasticsearch/issues/135525 - class: org.elasticsearch.index.codec.vectors.cluster.HierarchicalKMeansTests method: testFewDifferentValues issue: https://github.com/elastic/elasticsearch/issues/135538 From 30f384b73495e558ed0190e506fd3cc58804e25e Mon Sep 17 00:00:00 2001 From: Jordan Powers Date: Fri, 26 Sep 2025 07:59:28 -0700 Subject: [PATCH 4/5] Check old cluster version to determine if is snapshot build --- .../org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java | 3 +-- .../upgrades/LogsdbIndexingRollingUpgradeIT.java | 3 +-- .../elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java | 3 +-- .../elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java | 4 +--- .../upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java | 3 +-- .../upgrades/SyntheticSourceRollingUpgradeIT.java | 3 +-- .../java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java | 3 +-- 7 files changed, 7 insertions(+), 15 deletions(-) diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java index a7e0df072ba5c..2ddbec2dcaf64 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; import org.elasticsearch.client.Request; import java.io.IOException; @@ -32,7 +31,7 @@ public LogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java index f332e78a37f05..58df80e4a97f8 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; @@ -77,7 +76,7 @@ public LogsdbIndexingRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java index 259477a16b486..9baa789a73713 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; @@ -93,7 +92,7 @@ public MatchOnlyTextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java index 74bb22e982a19..b98e65532847e 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java @@ -11,8 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; - import java.time.Instant; import java.util.Map; @@ -30,7 +28,7 @@ public NoLogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java index 9916717ad7b04..a711ec7970c60 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.RestClient; @@ -117,7 +116,7 @@ protected Settings restClientSettings() { @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java index b801a74e19b91..3ba07e2be16bf 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java @@ -11,7 +11,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; import org.elasticsearch.client.Request; import org.elasticsearch.test.rest.ObjectPath; import org.hamcrest.Matchers; @@ -73,7 +72,7 @@ public SyntheticSourceRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java index 44aecaa708944..4c196d9183536 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java @@ -9,7 +9,6 @@ import com.carrotsearch.randomizedtesting.annotations.Name; -import org.elasticsearch.Build; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; @@ -90,7 +89,7 @@ public TextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { @Override protected void beforeUpgrade() { - if (Build.current().isSnapshot()) { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); } } From dc7c9fb2cfbe573959379634845b969e8d05bdb6 Mon Sep 17 00:00:00 2001 From: Jordan Powers Date: Fri, 26 Sep 2025 08:53:59 -0700 Subject: [PATCH 5/5] Move rename feature check to base classes --- .../upgrades/ParameterizedFullClusterRestartTestCase.java | 7 +++++++ .../upgrades/ParameterizedRollingUpgradeTestCase.java | 6 +++++- .../elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java | 7 ------- .../upgrades/LogsdbIndexingRollingUpgradeIT.java | 7 ------- .../upgrades/MatchOnlyTextRollingUpgradeIT.java | 7 ------- .../upgrades/NoLogsUsageRollingUpgradeIT.java | 7 ------- .../StandardToLogsDbIndexModeRollingUpgradeIT.java | 7 ------- .../upgrades/SyntheticSourceRollingUpgradeIT.java | 7 ------- .../org/elasticsearch/upgrades/TextRollingUpgradeIT.java | 7 ------- 9 files changed, 12 insertions(+), 50 deletions(-) diff --git a/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java b/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java index 5c83fee97cdca..b4ad764546c6f 100644 --- a/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java +++ b/qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedFullClusterRestartTestCase.java @@ -100,9 +100,16 @@ public void extractOldIndexVersion() throws Exception { } } + protected void beforeUpgrade() { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { + assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); + } + } + @Before public void maybeUpgrade() throws Exception { if (upgraded == false && requestedUpgradeStatus == UPGRADED) { + beforeUpgrade(); try { if (getOldClusterTestVersion().before(MINIMUM_WIRE_COMPATIBLE_VERSION)) { // First upgrade to latest wire compatible version diff --git a/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java b/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java index 12ebe6141b8ed..41a60a2880afb 100644 --- a/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java +++ b/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java @@ -54,7 +54,11 @@ public static Iterable parameters() { protected abstract ElasticsearchCluster getUpgradeCluster(); - protected void beforeUpgrade() {} + protected void beforeUpgrade() { + if (getOldClusterVersion().endsWith("-SNAPSHOT")) { + assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); + } + } @Before public void upgradeNode() throws Exception { diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java index 2ddbec2dcaf64..6fea6917bebc0 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java @@ -29,13 +29,6 @@ public LogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testUsage() throws Exception { assumeFalse("logsdb.prior_logs_usage only gets set in 8.x", oldClusterHasFeature("gte_v9.0.0")); String dataStreamName = "logs-mysql-error"; diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java index 58df80e4a97f8..48a709a66fa9e 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java @@ -74,13 +74,6 @@ public LogsdbIndexingRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) super(upgradedNodes); } - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testIndexing() throws Exception { String dataStreamName = "logs-bwc-test"; if (isOldCluster()) { diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java index 9baa789a73713..ab1f7e2e4480f 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java @@ -90,13 +90,6 @@ public MatchOnlyTextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testIndexing() throws Exception { assumeTrue( "Match only text block loader fix is not present in this cluster", diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java index b98e65532847e..efb93e4782c11 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java @@ -26,13 +26,6 @@ public NoLogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testUsage() throws Exception { String dataStreamName = "logs-mysql-error"; if (isOldCluster()) { diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java index a711ec7970c60..e8cf3027ac067 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java @@ -114,13 +114,6 @@ protected Settings restClientSettings() { } }"""; - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testLogsIndexing() throws IOException { if (isOldCluster()) { // given - create a template and data stream diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java index 3ba07e2be16bf..2d00366605350 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java @@ -70,13 +70,6 @@ public SyntheticSourceRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) super(upgradedNodes); } - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testIndexing() throws Exception { assumeTrue("requires storing leaf array offsets", oldClusterHasFeature("gte_v9.1.0")); String dataStreamName = "logs-bwc-test"; diff --git a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java index 4c196d9183536..0f0995d4550ce 100644 --- a/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java +++ b/x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java @@ -87,13 +87,6 @@ public TextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) { super(upgradedNodes); } - @Override - protected void beforeUpgrade() { - if (getOldClusterVersion().endsWith("-SNAPSHOT")) { - assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename")); - } - } - public void testIndexing() throws Exception { if (isOldCluster()) {