From d4ef6e0918a882cb3cb654d3b39a11e4db78084a Mon Sep 17 00:00:00 2001 From: Matteo Mazzola Date: Tue, 6 Jan 2026 18:08:44 +0000 Subject: [PATCH] Add busy assertion to avoid race condition for testStalledShardMigrationProperlyDetected --- .../java/org/elasticsearch/xpack/shutdown/NodeShutdownIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/shutdown/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownIT.java b/x-pack/plugin/shutdown/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownIT.java index 58a51aa3efdd8..b875ebb7655c3 100644 --- a/x-pack/plugin/shutdown/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownIT.java +++ b/x-pack/plugin/shutdown/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/shutdown/NodeShutdownIT.java @@ -325,7 +325,7 @@ public void testStalledShardMigrationProperlyDetected() throws Exception { // Mark the node for shutdown putNodeShutdown(nodeIdToShutdown, "remove"); - { + assertBusy(() -> { // Now check the shard migration status Request getStatusRequest = new Request("GET", "_nodes/" + nodeIdToShutdown + "/shutdown"); Response statusResponse = client().performRequest(getStatusRequest); @@ -340,7 +340,7 @@ public void testStalledShardMigrationProperlyDetected() throws Exception { ) ); assertThat(ObjectPath.eval("nodes.0.shard_migration.node_allocation_decision", status), notNullValue()); - } + }); // Now update the allocation requirements to unblock shard relocation Request updateSettingsRequest = new Request("PUT", indexName + "/_settings");