From 548247fed3d475f62595761f62a4818562ffb756 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Thu, 4 Sep 2025 15:24:03 +1000 Subject: [PATCH] [Test] Fix SnapshotMetricsIT testByStateCounts_InitAndQueuedShards Ensure new cluster state with init shards is visble to master before assertions. Resolves: #134089 --- .../org/elasticsearch/repositories/SnapshotMetricsIT.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/repositories/SnapshotMetricsIT.java b/server/src/internalClusterTest/java/org/elasticsearch/repositories/SnapshotMetricsIT.java index b6a84782ce333..b25d06982a8d0 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/repositories/SnapshotMetricsIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/repositories/SnapshotMetricsIT.java @@ -10,6 +10,7 @@ package org.elasticsearch.repositories; import org.elasticsearch.action.ActionFuture; +import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.cluster.SnapshotsInProgress; @@ -318,6 +319,9 @@ public void testByStateCounts_InitAndQueuedShards() throws Exception { .execute(); waitForBlockOnAnyDataNode(repositoryName); + safeAwait( + (ActionListener l) -> flushMasterQueue(internalCluster().getCurrentMasterNodeInstance(ClusterService.class), l) + ); // Should be {numShards} in INIT state, and 1 STARTED snapshot Map shardStates = getShardStates();