Tests: remove race condition in the masterShutdownDuringSnapshotTest

This commit is contained in:
Igor Motov 2015-06-03 10:05:46 -10:00
parent f0e6addc53
commit 90cbf80fc4
1 changed files with 8 additions and 7 deletions

View File

@ -847,21 +847,22 @@ public class DedicatedClusterSnapshotRestoreTests extends AbstractSnapshotTests
logger.info("--> unblocking snapshot execution"); logger.info("--> unblocking snapshot execution");
snapshotListener.unblock(); snapshotListener.unblock();
logger.info("--> wait until the snapshot is done");
} finally { } finally {
clusterService.remove(snapshotListener); clusterService.remove(snapshotListener);
} }
logger.info("--> wait until the snapshot is done");
assertBusy(new Runnable() { assertBusy(new Runnable() {
@Override @Override
public void run() { public void run() {
SnapshotsStatusResponse snapshotsStatusResponse = client().admin().cluster().prepareSnapshotStatus("test-repo").setSnapshots("test-snap").get(); GetSnapshotsResponse snapshotsStatusResponse = client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get();
ImmutableList<SnapshotStatus> snapshotStatuses = snapshotsStatusResponse.getSnapshots(); SnapshotInfo snapshotInfo = snapshotsStatusResponse.getSnapshots().get(0);
assertEquals(1, snapshotStatuses.size()); assertTrue(snapshotInfo.state().completed());
assertTrue(snapshotStatuses.get(0).getState().completed());
} }
}); }, 1, TimeUnit.MINUTES);
logger.info("--> verify that snapshot was succesful");
GetSnapshotsResponse snapshotsStatusResponse = client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get(); GetSnapshotsResponse snapshotsStatusResponse = client().admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get();
SnapshotInfo snapshotInfo = snapshotsStatusResponse.getSnapshots().get(0); SnapshotInfo snapshotInfo = snapshotsStatusResponse.getSnapshots().get(0);