From ca47f680912ddf3d67465ad0722b180a8e70d20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Tue, 5 Feb 2019 19:07:53 +0100 Subject: [PATCH] Ignore type-removal warnings in XPackRestTestHelper (#38431) The backport of #38022 introduced types-deprecation warning for get/put template requests that cause problems on tests master in mixed cluster scenarios. While these warnings are caught and ignored in regular Rest tests, the get template requests in XPackRestTestHelper were missed. Closes #38412 --- .../elasticsearch/xpack/test/rest/XPackRestTestHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestTestHelper.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestTestHelper.java index 082992d95ff..863908ab7fa 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestTestHelper.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/test/rest/XPackRestTestHelper.java @@ -14,6 +14,7 @@ import org.elasticsearch.client.RestClient; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xpack.core.ml.MlMetaIndex; import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex; import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndexFields; @@ -76,7 +77,9 @@ public final class XPackRestTestHelper { ESTestCase.awaitBusy(() -> { Map response; try { - String string = EntityUtils.toString(client.performRequest(new Request("GET", "/_template/" + template)).getEntity()); + final Request getRequest = new Request("GET", "_template/" + template); + getRequest.setOptions(ESRestTestCase.allowTypeRemovalWarnings()); + String string = EntityUtils.toString(client.performRequest(getRequest).getEntity()); response = XContentHelper.convertToMap(JsonXContent.jsonXContent, string, false); } catch (ResponseException e) { if (e.getResponse().getStatusLine().getStatusCode() == 404) {