Skip to content

Commit

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

* Allow system index warning



* Add to CHANGELOG



* Address code review comments



---------


(cherry picked from commit f14b5c8)

Signed-off-by: Craig Perkins <[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 3a1be63 commit 006821a
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 @@ -35,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Updated the `indices.query.bool.max_clause_count` setting from being static to dynamically updateable ([#13568](https://github.com/opensearch-project/OpenSearch/pull/13568))
- 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 @@ -720,11 +720,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 006821a

Please sign in to comment.