فهرست منبع

Fix SnapshotStatusApisIT (#45929)

The snapshot status when blocking can still be INIT in rare cases when
the new cluster state that has the snapshot in `STARTED` hasn't yet
become visible.
Fixes #45917
Armin Braun 6 سال پیش
والد
کامیت
2599e2331c
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      server/src/test/java/org/elasticsearch/snapshots/SnapshotStatusApisIT.java

+ 3 - 2
server/src/test/java/org/elasticsearch/snapshots/SnapshotStatusApisIT.java

@@ -29,6 +29,7 @@ import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.TimeValue;
 
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
 import static org.hamcrest.Matchers.equalTo;
@@ -76,7 +77,7 @@ public class SnapshotStatusApisIT extends AbstractSnapshotIntegTestCase {
         assertEquals(snStatus.getStats().getTime(), snapshotInfo.endTime() - snapshotInfo.startTime());
     }
 
-    public void testStatusAPICallInProgressSnapshot() throws InterruptedException {
+    public void testStatusAPICallInProgressSnapshot() throws Exception {
         Client client = client();
 
         logger.info("-->  creating repository");
@@ -101,7 +102,7 @@ public class SnapshotStatusApisIT extends AbstractSnapshotIntegTestCase {
 
         final List<SnapshotStatus> snapshotStatus = client.admin().cluster().snapshotsStatus(
             new SnapshotsStatusRequest("test-repo", new String[]{"test-snap"})).actionGet().getSnapshots();
-        assertEquals(snapshotStatus.get(0).getState(), SnapshotsInProgress.State.STARTED);
+        assertBusy(() -> assertEquals(SnapshotsInProgress.State.STARTED, snapshotStatus.get(0).getState()), 1L, TimeUnit.MINUTES);
 
         logger.info("--> unblock all data nodes");
         unblockAllDataNodes("test-repo");