Skip to content

Commit

Permalink
Ignore warnings related to types deprecation in REST tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Nov 9, 2018
1 parent 5c2a5f2 commit 6e1bd95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,21 @@ void checkWarningHeaders(final List<String> warningHeaders, final Version master
if (matches) {
final String message = matcher.group(1);
// noinspection StatementWithEmptyBody
if (masterVersion.before(Version.V_7_0_0)
if ((masterVersion.before(Version.V_7_0_0)
&& message.equals("the default number of shards will change from [5] to [1] in 7.0.0; "
+ "if you wish to continue using the default of [5] shards, "
+ "you must manage this on the create index request or with an index template")) {
+ "you must manage this on the create index request or with an index template"))
|| message.startsWith("[types removal]")) {
/*
* 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.
* We ignore two classes of warning headers:
* - The default number of shards warning 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.
* - 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 if (expected.remove(message) == false) {
unexpected.add(header);
}
} else {
unmatched.add(header);
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), Version.CURRENT);
}

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

0 comments on commit 6e1bd95

Please sign in to comment.