Skip to content

Commit ea1cad7

Browse files
opensearch-trigger-bot[bot]github-actions[bot]
authored andcommitted
Allow system index warning in OpenSearchRestTestCase.refreshAllIndices (opensearch-project#14635) (opensearch-project#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> Signed-off-by: kkewwei <[email protected]>
1 parent 7767039 commit ea1cad7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3535
- Updated the `indices.query.bool.max_clause_count` setting from being static to dynamically updateable ([#13568](https://github.com/opensearch-project/OpenSearch/pull/13568))
3636
- Allow @InternalApi annotation on classes not meant to be constructed outside of the OpenSearch core ([#14575](https://github.com/opensearch-project/OpenSearch/pull/14575))
3737
- Add @InternalApi annotation to japicmp exclusions ([#14597](https://github.com/opensearch-project/OpenSearch/pull/14597))
38+
- Allow system index warning in OpenSearchRestTestCase.refreshAllIndices ([#14635](https://github.com/opensearch-project/OpenSearch/pull/14635))
3839

3940
### Deprecated
4041

test/framework/src/main/java/org/opensearch/test/rest/OpenSearchRestTestCase.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,15 @@ protected void refreshAllIndices() throws IOException {
720720
requestOptions.setWarningsHandler(warnings -> {
721721
if (warnings.isEmpty()) {
722722
return false;
723-
} else if (warnings.size() > 1) {
724-
return true;
725-
} else {
726-
return warnings.get(0).startsWith("this request accesses system indices:") == false;
727723
}
724+
boolean allSystemIndexWarnings = true;
725+
for (String warning : warnings) {
726+
if (!warning.startsWith("this request accesses system indices:")) {
727+
allSystemIndexWarnings = false;
728+
break;
729+
}
730+
}
731+
return !allSystemIndexWarnings;
728732
});
729733
refreshRequest.setOptions(requestOptions);
730734
client().performRequest(refreshRequest);

0 commit comments

Comments
 (0)