Skip to content

Commit c1ed462

Browse files
committed
Ignore warnings related to types deprecation in REST tests. (#35395)
1 parent 20883d1 commit c1ed462

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,13 @@ void checkWarningHeaders(final List<String> warningHeaders) {
300300
* This warning header will come back in the vast majority of our tests that create an index. Rather than rewrite our
301301
* tests to assert this warning header, we assume that it is expected.
302302
*/
303-
}
304-
else if (expected.remove(message) == false) {
303+
} else // noinspection StatementWithEmptyBody
304+
if (message.startsWith("[types removal]")) {
305+
/*
306+
* We skip warnings related to types deprecation so that we can continue to run the many
307+
* mixed-version tests that used typed APIs.
308+
*/
309+
} else if (expected.remove(message) == false) {
305310
unexpected.add(header);
306311
}
307312
} else {

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));
139+
}
140+
131141
public void testParseDoSectionNoBody() throws Exception {
132142
parser = createParser(YamlXContent.yamlXContent,
133143
"get:\n" +

0 commit comments

Comments
 (0)