Skip to content

Commit

Permalink
[Transform] fix version check for beta transforms (elastic#78364)
Browse files Browse the repository at this point in the history
fix the version check for deprecated beta transforms, this was introduced in elastic#77565, but
contained a typo (7.15 instead of 7.5)
  • Loading branch information
Hendrik Muhs authored Sep 28, 2021
1 parent 2d6f6b6 commit dfd65be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@ public List<DeprecationIssue> checkForDeprecations(NamedXContentRegistry namedXC

List<DeprecationIssue> 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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
),
Expand Down

0 comments on commit dfd65be

Please sign in to comment.