Skip to content

Commit bc799e4

Browse files
authored
Ignore warnings related to types deprecation in REST tests. (#35395)
1 parent 6cb2aef commit bc799e4

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,14 @@ void checkWarningHeaders(final List<String> warningHeaders, final Version master
301301
* This warning header will come back in the vast majority of our tests that create an index when running against an
302302
* older master. Rather than rewrite our tests to assert this warning header, we assume that it is expected.
303303
*/
304-
} else {
305-
if (expected.remove(message) == false) {
306-
unexpected.add(header);
307-
}
304+
} else // noinspection StatementWithEmptyBody
305+
if (message.startsWith("[types removal]")) {
306+
/*
307+
* We skip warnings related to types deprecation so that we can continue to run the many
308+
* mixed-version tests that used typed APIs.
309+
*/
310+
} else if (expected.remove(message) == false) {
311+
unexpected.add(header);
308312
}
309313
} else {
310314
unmatched.add(header);

test/framework/src/test/java/org/elasticsearch/test/rest/yaml/section/DoSectionTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ public void testWarningHeaders() {
128128
}
129129
}
130130

131+
public void testIgnoreTypesWarnings() {
132+
String legitimateWarning = DeprecationLogger.formatWarning("warning");
133+
String typesWarning = DeprecationLogger.formatWarning("[types removal] " +
134+
"The endpoint /{index}/{type}/_count is deprecated, use /{index}/_count instead.");
135+
136+
DoSection section = new DoSection(new XContentLocation(1, 1));
137+
section.setExpectedWarningHeaders(singletonList("warning"));
138+
section.checkWarningHeaders(Arrays.asList(legitimateWarning, typesWarning), Version.CURRENT);
139+
}
140+
131141
public void testParseDoSectionNoBody() throws Exception {
132142
parser = createParser(YamlXContent.yamlXContent,
133143
"get:\n" +

0 commit comments

Comments
 (0)