From bf6e8e990ebb07a9835f9a84383903dda32a4f04 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Mon, 28 Jan 2019 17:08:39 +0000 Subject: [PATCH] Add rest test --- .../test/deprecation/10_basic.yml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml index ed6c640abd99f..1ddd75bb36845 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/deprecation/10_basic.yml @@ -14,3 +14,46 @@ setup: - length: { index_settings: 0 } - length: { ml_settings: 0 } +--- +"Test ml": + - skip: + features: ["headers", "warnings"] + reason: testing a deprecated field + +# Index the config directly to prevent the deprecated +# use_dis_max field being rewritten by the parser. This +# simulates the config being created in an older version +# of elasticsearch + - do: + headers: + Content-Type: application/json + index: + index: .ml-config + type: doc + id: deprecation-datafeed-datafeed + body: > + { + "datafeed_id" : "deprecation-datafeed", + "config_type" : "datafeed", + "job_id" : "deprecation-job", + "indices" : ["index-foo"], + "query" : { + "query_string" : { + "query" : "foo", + "use_dis_max" : true + } + } + } + + - do: + indices.refresh: + index: [.ml-config] + + - do: + warnings: + - Deprecated field [use_dis_max] used, replaced by [Set [tie_breaker] to 1 instead] + xpack.migration.deprecations: + index: "*" + - length: { ml_settings: 1 } + - match: { ml_settings.0.level : warning } + - match: { ml_settings.0.message : "Datafeed [deprecation-datafeed] uses deprecated query options" }