Skip to content

Commit

Permalink
Fix SnapshotStatusApisIT (#45929)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
original-brownbear committed Aug 26, 2019
1 parent fbecbcf commit 2599e23
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void testStatusApiConsistency() {
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");
Expand All @@ -101,7 +102,7 @@ public void testStatusAPICallInProgressSnapshot() throws InterruptedException {

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");
Expand Down

0 comments on commit 2599e23

Please sign in to comment.