Skip to content

Commit

Permalink
Ignore warnings related to types deprecation in REST tests. (#35395)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Dec 18, 2018
1 parent 20883d1 commit c1ed462
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,13 @@ void checkWarningHeaders(final List<String> warningHeaders) {
* This warning header will come back in the vast majority of our tests that create an index. Rather than rewrite our
* tests to assert this warning header, we assume that it is expected.
*/
}
else if (expected.remove(message) == false) {
} else // noinspection StatementWithEmptyBody
if (message.startsWith("[types removal]")) {
/*
* We skip warnings related to types deprecation so that we can continue to run the many
* mixed-version tests that used typed APIs.
*/
} else if (expected.remove(message) == false) {
unexpected.add(header);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ public void testWarningHeaders() {
}
}

public void testIgnoreTypesWarnings() {
String legitimateWarning = DeprecationLogger.formatWarning("warning");
String typesWarning = DeprecationLogger.formatWarning("[types removal] " +
"The endpoint /{index}/{type}/_count is deprecated, use /{index}/_count instead.");

DoSection section = new DoSection(new XContentLocation(1, 1));
section.setExpectedWarningHeaders(singletonList("warning"));
section.checkWarningHeaders(Arrays.asList(legitimateWarning, typesWarning));
}

public void testParseDoSectionNoBody() throws Exception {
parser = createParser(YamlXContent.yamlXContent,
"get:\n" +
Expand Down

0 comments on commit c1ed462

Please sign in to comment.