@@ -116,7 +116,7 @@ public void testStatusApiConsistency() {
116
116
assertEquals (snapshotStatus .getStats ().getTime (), snapshotInfo .endTime () - snapshotInfo .startTime ());
117
117
}
118
118
119
- public void testStatusAPICallForShallowCopySnapshot () {
119
+ public void testStatusAPICallForShallowCopySnapshot () throws Exception {
120
120
disableRepoConsistencyCheck ("Remote store repository is being used for the test" );
121
121
internalCluster ().startClusterManagerOnlyNode ();
122
122
internalCluster ().startDataOnlyNode ();
@@ -136,15 +136,24 @@ public void testStatusAPICallForShallowCopySnapshot() {
136
136
final String snapshot = "snapshot" ;
137
137
createFullSnapshot (snapshotRepoName , snapshot );
138
138
139
- final SnapshotStatus snapshotStatus = getSnapshotStatus (snapshotRepoName , snapshot );
140
- assertThat (snapshotStatus .getState (), is (SnapshotsInProgress .State .SUCCESS ));
139
+ assertBusy (() -> {
140
+ final SnapshotStatus snapshotStatus = client ().admin ()
141
+ .cluster ()
142
+ .prepareSnapshotStatus (snapshotRepoName )
143
+ .setSnapshots (snapshot )
144
+ .execute ()
145
+ .actionGet ()
146
+ .getSnapshots ()
147
+ .get (0 );
148
+ assertThat (snapshotStatus .getState (), is (SnapshotsInProgress .State .SUCCESS ));
141
149
142
- final SnapshotIndexShardStatus snapshotShardState = stateFirstShard (snapshotStatus , indexName );
143
- assertThat (snapshotShardState .getStage (), is (SnapshotIndexShardStage .DONE ));
144
- assertThat (snapshotShardState .getStats ().getTotalFileCount (), greaterThan (0 ));
145
- assertThat (snapshotShardState .getStats ().getTotalSize (), greaterThan (0L ));
146
- assertThat (snapshotShardState .getStats ().getIncrementalFileCount (), greaterThan (0 ));
147
- assertThat (snapshotShardState .getStats ().getIncrementalSize (), greaterThan (0L ));
150
+ final SnapshotIndexShardStatus snapshotShardState = stateFirstShard (snapshotStatus , indexName );
151
+ assertThat (snapshotShardState .getStage (), is (SnapshotIndexShardStage .DONE ));
152
+ assertThat (snapshotShardState .getStats ().getTotalFileCount (), greaterThan (0 ));
153
+ assertThat (snapshotShardState .getStats ().getTotalSize (), greaterThan (0L ));
154
+ assertThat (snapshotShardState .getStats ().getIncrementalFileCount (), greaterThan (0 ));
155
+ assertThat (snapshotShardState .getStats ().getIncrementalSize (), greaterThan (0L ));
156
+ }, 20 , TimeUnit .SECONDS );
148
157
}
149
158
150
159
public void testStatusAPICallInProgressSnapshot () throws Exception {
@@ -193,7 +202,7 @@ public void testExceptionOnMissingSnapBlob() throws IOException {
193
202
);
194
203
}
195
204
196
- public void testExceptionOnMissingShardLevelSnapBlob () throws IOException {
205
+ public void testExceptionOnMissingShardLevelSnapBlob () throws Exception {
197
206
disableRepoConsistencyCheck ("This test intentionally corrupts the repository" );
198
207
199
208
final Path repoPath = randomRepoPath ();
@@ -216,11 +225,12 @@ public void testExceptionOnMissingShardLevelSnapBlob() throws IOException {
216
225
repoPath .resolve (resolvePath (indexId , "0" ))
217
226
.resolve (BlobStoreRepository .SNAPSHOT_PREFIX + snapshotInfo .snapshotId ().getUUID () + ".dat" )
218
227
);
219
-
220
- expectThrows (
221
- SnapshotMissingException .class ,
222
- () -> client ().admin ().cluster ().prepareSnapshotStatus ("test-repo" ).setSnapshots ("test-snap" ).execute ().actionGet ()
223
- );
228
+ assertBusy (() -> {
229
+ expectThrows (
230
+ SnapshotMissingException .class ,
231
+ () -> client ().admin ().cluster ().prepareSnapshotStatus ("test-repo" ).setSnapshots ("test-snap" ).execute ().actionGet ()
232
+ );
233
+ }, 20 , TimeUnit .SECONDS );
224
234
}
225
235
226
236
public void testGetSnapshotsWithoutIndices () throws Exception {
0 commit comments