From dfd65beaf66968b8b3d49ee5062a885cf7f40da0 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Tue, 28 Sep 2021 13:15:52 +0200 Subject: [PATCH] [Transform] fix version check for beta transforms (#78364) fix the version check for deprecated beta transforms, this was introduced in #77565, but contained a typo (7.15 instead of 7.5) --- .../transform/transforms/TransformConfig.java | 8 +++---- .../transforms/TransformConfigTests.java | 24 ++++++++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java index 06de022e507b8..05bce04b3f3ee 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java @@ -371,14 +371,14 @@ public List checkForDeprecations(NamedXContentRegistry namedXC List deprecations = new ArrayList<>(); - // V_8_0_0 deprecate beta transforms - if (getVersion() == null || getVersion().before(Version.V_7_15_0)) { + // deprecate beta transforms + if (getVersion() == null || getVersion().before(Version.V_7_5_0)) { deprecations.add( new DeprecationIssue( - Level.CRITICAL, // change to WARNING for 7.x + Level.CRITICAL, "Transform [" + id + "] is too old", TransformDeprecations.BREAKING_CHANGES_BASE_URL, - "The configuration uses an old format, you can use [_update] or [_upgrade] to update to configuration", + "The configuration uses an old format, you can use [_update] or [_upgrade] to update", false, null ) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java index 3d3b54d9c59c9..20d0c7b6114a5 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java @@ -724,6 +724,28 @@ public void testCheckForDeprecations() { ) ); + deprecatedConfig = randomTransformConfigWithDeprecatedFields(id, Version.V_7_10_0); + + // check _and_ clear warnings + assertWarnings("[max_page_search_size] is deprecated inside pivot please use settings instead"); + + // important: checkForDeprecations does _not_ create new deprecation warnings + assertThat( + deprecatedConfig.checkForDeprecations(xContentRegistry()), + equalTo( + List.of( + new DeprecationIssue( + Level.WARNING, + "Transform [" + id + "] uses deprecated max_page_search_size", + "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html", + "[max_page_search_size] is deprecated inside pivot please use settings instead", + false, + null + ) + ) + ) + ); + deprecatedConfig = randomTransformConfigWithDeprecatedFields(id, Version.V_7_4_0); // check _and_ clear warnings @@ -738,7 +760,7 @@ public void testCheckForDeprecations() { Level.CRITICAL, "Transform [" + id + "] is too old", "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html", - "The configuration uses an old format, you can use [_update] or [_upgrade] to update to configuration", + "The configuration uses an old format, you can use [_update] or [_upgrade] to update", false, null ),