From 6f2cebd49ab22521f79d97abc8c7091d6bab59eb Mon Sep 17 00:00:00 2001 From: Nick Tindall Date: Sat, 25 Jul 2026 08:51:09 +1000 Subject: [PATCH 1/2] Fix ShardRoutingTests#testEqualsIgnoringVersion --- muted-tests.yml | 3 --- .../elasticsearch/cluster/routing/ShardRoutingTests.java | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 80e07304303e3..a1f70f9ed89c7 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -588,9 +588,6 @@ tests: - class: org.elasticsearch.xpack.esql.CsvIT method: test {csv-spec:change_point.values null column} issue: https://github.com/elastic/elasticsearch/issues/154877 -- class: org.elasticsearch.cluster.routing.ShardRoutingTests - method: testEqualsIgnoringVersion - issue: https://github.com/elastic/elasticsearch/issues/154886 - class: org.elasticsearch.xpack.core.ml.datafeed.DatafeedUpdateTests method: testIsUserInitiatedProjectRoutingChangeWhenRoutingNarrowsShouldReturnTrue issue: https://github.com/elastic/elasticsearch/issues/154908 diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java index 22d9ac426ed3e..4c504b397e0ee 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java @@ -392,6 +392,8 @@ public void testEqualsIgnoringVersion() { if (otherRouting.started()) { unchanged = true; } else { + final var originalState = otherRouting.state(); + final var originalRelocatingNodeId = otherRouting.relocatingNodeId(); otherRouting = new ShardRouting( otherRouting.shardId(), otherRouting.currentNodeId(), @@ -399,7 +401,10 @@ public void testEqualsIgnoringVersion() { otherRouting.primary(), otherRouting.state(), otherRouting.recoverySource(), - TestShardRouting.buildRecoveryPriority(otherRouting.state(), otherRouting.relocatingNodeId() != null), + randomValueOtherThan( + otherRouting.recoveryPriority(), + () -> TestShardRouting.buildRecoveryPriority(originalState, originalRelocatingNodeId != null) + ), otherRouting.unassignedInfo(), otherRouting.relocationFailureInfo(), otherRouting.allocationId(), From 188e3fec04c8174c71033bf18ed431ae6bdc2f7e Mon Sep 17 00:00:00 2001 From: Nick Tindall Date: Sat, 25 Jul 2026 09:21:30 +1000 Subject: [PATCH 2/2] Don't reset recoveryPriority --- .../org/elasticsearch/cluster/routing/ShardRoutingTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java index 4c504b397e0ee..883b4aff57f2e 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/ShardRoutingTests.java @@ -454,6 +454,7 @@ public void testEqualsIgnoringVersion() { otherRouting.primary(), otherRouting.state() ).withRelocatingNodeId(otherRouting.relocatingNodeId()) + .withRecoveryPriority(otherRouting.recoveryPriority()) .withUnassignedInfo( otherRouting.unassignedInfo() == null ? new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "test")