Skip to content

Commit

Permalink
Allow system index warning in OpenSearchRestTestCase.refreshAllIndices (
Browse files Browse the repository at this point in the history
opensearch-project#14635)

* Allow system index warning

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Add to CHANGELOG

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Address code review comments

Signed-off-by: Craig Perkins <cwperx@amazon.com>

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks authored and wangdongyu.danny committed Aug 22, 2024
1 parent 2d03ad4 commit 18ea5e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Make the class CommunityIdProcessor final ([#14448](https://github.com/opensearch-project/OpenSearch/pull/14448))
- Allow @InternalApi annotation on classes not meant to be constructed outside of the OpenSearch core ([#14575](https://github.com/opensearch-project/OpenSearch/pull/14575))
- Add @InternalApi annotation to japicmp exclusions ([#14597](https://github.com/opensearch-project/OpenSearch/pull/14597))
- Allow system index warning in OpenSearchRestTestCase.refreshAllIndices ([#14635](https://github.com/opensearch-project/OpenSearch/pull/14635))

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,15 @@ protected void refreshAllIndices() throws IOException {
requestOptions.setWarningsHandler(warnings -> {
if (warnings.isEmpty()) {
return false;
} else if (warnings.size() > 1) {
return true;
} else {
return warnings.get(0).startsWith("this request accesses system indices:") == false;
}
boolean allSystemIndexWarnings = true;
for (String warning : warnings) {
if (!warning.startsWith("this request accesses system indices:")) {
allSystemIndexWarnings = false;
break;
}
}
return !allSystemIndexWarnings;
});
refreshRequest.setOptions(requestOptions);
client().performRequest(refreshRequest);
Expand Down

0 comments on commit 18ea5e3

Please sign in to comment.