Ignore warnings related to types deprecation in REST tests. (#35395)

This commit is contained in:
Julie Tibshirani 2018-11-13 11:56:01 -08:00 committed by GitHub
parent 6cb2aef943
commit bc799e4a6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -301,10 +301,14 @@ public class DoSection implements ExecutableSection {
* This warning header will come back in the vast majority of our tests that create an index when running against an * This warning header will come back in the vast majority of our tests that create an index when running against an
* older master. Rather than rewrite our tests to assert this warning header, we assume that it is expected. * older master. Rather than rewrite our tests to assert this warning header, we assume that it is expected.
*/ */
} else { } else // noinspection StatementWithEmptyBody
if (expected.remove(message) == false) { if (message.startsWith("[types removal]")) {
unexpected.add(header); /*
} * 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 { } else {
unmatched.add(header); unmatched.add(header);

View File

@ -128,6 +128,16 @@ public class DoSectionTests extends AbstractClientYamlTestFragmentParserTestCase
} }
} }
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), Version.CURRENT);
}
public void testParseDoSectionNoBody() throws Exception { public void testParseDoSectionNoBody() throws Exception {
parser = createParser(YamlXContent.yamlXContent, parser = createParser(YamlXContent.yamlXContent,
"get:\n" + "get:\n" +