Skip to content

Commit 27d76b6

Browse files
martijnvgsmalyshev
authored andcommitted
Update ESRestTestCase's ROLLUP_REQUESTS_OPTIONS (#121335)
Sometimes there are multiple warning.
1 parent 34e7f5a commit 27d76b6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,16 @@ public abstract class ESRestTestCase extends ESTestCase {
169169
private static final String EXPECTED_ROLLUP_WARNING_MESSAGE =
170170
"The rollup functionality will be removed in Elasticsearch 10.0. See docs for more information.";
171171
public static final RequestOptions.Builder ROLLUP_REQUESTS_OPTIONS = RequestOptions.DEFAULT.toBuilder().setWarningsHandler(warnings -> {
172-
// Either no warning, because of bwc integration test OR
173-
// the expected warning, because on current version
174172
if (warnings.isEmpty()) {
175173
return false;
176-
} else if (warnings.size() == 1 && EXPECTED_ROLLUP_WARNING_MESSAGE.equals(warnings.get(0))) {
177-
return false;
178174
} else {
179-
return true;
175+
// Sometimes multiple rollup deprecation warnings. Transport actions can be invoked multiple time on different nodes.
176+
for (String warning : warnings) {
177+
if (EXPECTED_ROLLUP_WARNING_MESSAGE.equals(warning) == false) {
178+
return true;
179+
}
180+
}
181+
return false;
180182
}
181183
});
182184

0 commit comments

Comments
 (0)