Skip to content

Commit f14b5c8

Browse files
authored
Allow system index warning in OpenSearchRestTestCase.refreshAllIndices (#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>
1 parent 74230b7 commit f14b5c8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3636
- Make the class CommunityIdProcessor final ([#14448](https://github.com/opensearch-project/OpenSearch/pull/14448))
3737
- Allow @InternalApi annotation on classes not meant to be constructed outside of the OpenSearch core ([#14575](https://github.com/opensearch-project/OpenSearch/pull/14575))
3838
- Add @InternalApi annotation to japicmp exclusions ([#14597](https://github.com/opensearch-project/OpenSearch/pull/14597))
39+
- Allow system index warning in OpenSearchRestTestCase.refreshAllIndices ([#14635](https://github.com/opensearch-project/OpenSearch/pull/14635))
3940

4041
### Deprecated
4142

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,15 @@ protected void refreshAllIndices() throws IOException {
708708
requestOptions.setWarningsHandler(warnings -> {
709709
if (warnings.isEmpty()) {
710710
return false;
711-
} else if (warnings.size() > 1) {
712-
return true;
713-
} else {
714-
return warnings.get(0).startsWith("this request accesses system indices:") == false;
715711
}
712+
boolean allSystemIndexWarnings = true;
713+
for (String warning : warnings) {
714+
if (!warning.startsWith("this request accesses system indices:")) {
715+
allSystemIndexWarnings = false;
716+
break;
717+
}
718+
}
719+
return !allSystemIndexWarnings;
716720
});
717721
refreshRequest.setOptions(requestOptions);
718722
client().performRequest(refreshRequest);

0 commit comments

Comments
 (0)