Fix warning handler used in DataStreamsUpgradeIT (#59960) (#60682)

This commit is contained in:
Dan Hermann 2020-08-04 16:23:46 -05:00 committed by GitHub
parent 959690a64a
commit 9d96128c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -1435,8 +1435,15 @@ public abstract class ESRestTestCase extends ESTestCase {
protected static void useIgnoreMultipleMatchingTemplatesWarningsHandler(Request request) throws IOException { protected static void useIgnoreMultipleMatchingTemplatesWarningsHandler(Request request) throws IOException {
RequestOptions.Builder options = request.getOptions().toBuilder(); RequestOptions.Builder options = request.getOptions().toBuilder();
options.setWarningsHandler(warnings -> { options.setWarningsHandler(warnings -> {
return warnings.stream().anyMatch(message -> CREATE_INDEX_MULTIPLE_MATCHING_TEMPLATES.matcher(message).matches() || if (warnings.size() > 0) {
boolean matches = warnings.stream().anyMatch(
message -> CREATE_INDEX_MULTIPLE_MATCHING_TEMPLATES.matcher(message).matches() ||
PUT_TEMPLATE_MULTIPLE_MATCHING_TEMPLATES.matcher(message).matches()); PUT_TEMPLATE_MULTIPLE_MATCHING_TEMPLATES.matcher(message).matches());
return matches == false;
} else {
return false;
}
}); });
request.setOptions(options);
} }
} }