Skip to content

Commit

Permalink
fix flaky test - handle IllegalStateException and throw AssertionErro…
Browse files Browse the repository at this point in the history
…r to use assertbusy (#11981) (#12109)

* fix flaky test - handle IllegalStateException and throw AssertionError to use assertbusy



* Empty Commit to retry the build



---------


(cherry picked from commit bf5e628)

Signed-off-by: bansvaru <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a66f2f3 commit 2011c13
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,16 @@ private void validateCurrentMetadata() throws Exception {
internalCluster().getClusterManagerName()
);
assertBusy(() -> {
ClusterMetadataManifest manifest = remoteClusterStateService.getLatestClusterMetadataManifest(
getClusterState().getClusterName().value(),
getClusterState().metadata().clusterUUID()
).get();
ClusterMetadataManifest manifest;
try {
manifest = remoteClusterStateService.getLatestClusterMetadataManifest(
getClusterState().getClusterName().value(),
getClusterState().metadata().clusterUUID()
).get();
} catch (IllegalStateException e) {
// AssertionError helps us use assertBusy and retry validation if failed due to a race condition.
throw new AssertionError("Error while validating latest cluster metadata", e);
}
ClusterState clusterState = getClusterState();
Metadata currentMetadata = clusterState.metadata();
assertEquals(currentMetadata.indices().size(), manifest.getIndices().size());
Expand Down

0 comments on commit 2011c13

Please sign in to comment.