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();