Skip to content

Commit

Permalink
Snapshot tests stability improved. An exception is not able to interr…
Browse files Browse the repository at this point in the history
…upt active waiting.

Signed-off-by: Lukasz Soszynski <[email protected]>
  • Loading branch information
lukasz-soszynski-eliatra committed Oct 24, 2022
1 parent f6c8b4c commit f7d2726
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public void cleanData() throws ExecutionException, InterruptedException {
if (indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indexToBeDeleted);
indices.delete(deleteIndexRequest).actionGet();
Awaitility.await().until(() -> indices.exists(indicesExistsRequest).get().isExists() == false);
Awaitility.await().ignoreExceptions().until(() -> indices.exists(indicesExistsRequest).get().isExists() == false);
}
}

Expand Down Expand Up @@ -1629,7 +1629,8 @@ public void shouldRestoreSnapshot_positive() throws IOException {

// 7. wait until snapshot is restored
CountRequest countRequest = new CountRequest(RESTORED_SONG_INDEX_NAME);
Awaitility.await().until(() -> restHighLevelClient.count(countRequest, DEFAULT).getCount() == 2);
Awaitility.await().ignoreExceptions().alias("Index contains proper number of documents restored from snapshot.")
.until(() -> restHighLevelClient.count(countRequest, DEFAULT).getCount() == 2);

//8. verify that document are present in restored index
assertThat(internalClient, clusterContainsDocumentWithFieldValue(RESTORED_SONG_INDEX_NAME, "Eins", FIELD_TITLE, TITLE_MAGNUM_OPUS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public CreateSnapshotResponse createSnapshot(String repositoryName, String snaps

public void waitForSnapshotCreation(String repositoryName, String snapshotName) {
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest(repositoryName, new String[] { snapshotName });
Awaitility.await().until(() -> {
Awaitility.await().alias("wait for snapshot creation").ignoreExceptions().until(() -> {
GetSnapshotsResponse snapshotsResponse = snapshotClient.get(getSnapshotsRequest, DEFAULT);
SnapshotInfo snapshotInfo = snapshotsResponse.getSnapshots().get(0);
return SnapshotState.SUCCESS.equals(snapshotInfo.state());
Expand Down

0 comments on commit f7d2726

Please sign in to comment.