瀏覽代碼

Fix SnapshotStatusApisIT#testInfiniteTimeout (#108294)

Make sure that the create-snapshot task completes on the master node before
we start checking the status of the snapshot

Resolve #107405

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Artem Prigoda 1 年之前
父節點
當前提交
a049496aff

+ 3 - 0
server/src/internalClusterTest/java/org/elasticsearch/snapshots/SnapshotStatusApisIT.java

@@ -21,6 +21,7 @@ import org.elasticsearch.client.internal.Client;
 import org.elasticsearch.cluster.SnapshotsInProgress;
 import org.elasticsearch.cluster.metadata.IndexMetadata;
 import org.elasticsearch.cluster.service.ClusterService;
+import org.elasticsearch.common.Priority;
 import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.ByteSizeUnit;
@@ -700,6 +701,8 @@ public class SnapshotStatusApisIT extends AbstractSnapshotIntegTestCase {
             .execute();
         try {
             waitForBlockOnAnyDataNode("test-repo");
+            // Make sure that the create-snapshot task completes on master
+            assertFalse(clusterAdmin().prepareHealth().setWaitForEvents(Priority.LANGUID).get().isTimedOut());
             final List<SnapshotStatus> snapshotStatus = clusterAdmin().prepareSnapshotStatus("test-repo")
                 .setMasterNodeTimeout(TimeValue.MINUS_ONE)
                 .get()