From a299dfbf43748ed0b4943a93e2ab9f55d61eed36 Mon Sep 17 00:00:00 2001 From: nknize Date: Wed, 10 Feb 2021 09:11:23 -0600 Subject: [PATCH] [TEST] Fix Feature Flags in Test Framework and SortTemplates yaml failure This commit adds parse logic to correctly parse feature flags in the test framework. It also fixes a test failure in cat.templates/Sort Templates yaml test. --- .../rest-api-spec/test/cat.templates/10_basic.yml | 8 ++++---- .../test/rest/yaml/section/SkipSection.java | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.templates/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.templates/10_basic.yml index 8730c1f336cec..a75dc8b812769 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.templates/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.templates/10_basic.yml @@ -230,8 +230,8 @@ - match: $body: | /^ - test \s+ \[t\*\] \s+ \n \n - test_1 \s+ \[te\*\] \s+ 1 \n \n + test \s+ \[t\*\] \s+ \n + test_1 \s+ \[te\*\] \s+ 1 \n $/ - do: @@ -242,8 +242,8 @@ - match: $body: | /^ - test_1 \s+ \[te\*\] \s+ 1\n \n - test \s+ \[t\*\] \s+ \n \n + test_1 \s+ \[te\*\] \s+ 1\n + test \s+ \[t\*\] \s+ \n $/ diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java index 81eb470892010..0113fd09e855c 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/SkipSection.java @@ -71,7 +71,17 @@ public static SkipSection parse(XContentParser parser) throws IOException { } else if ("reason".equals(currentFieldName)) { reason = parser.text(); } else if ("features".equals(currentFieldName)) { - features.add(parser.text()); + String f = parser.text(); + // split on ',' + String[] fs = f.split(","); + if (fs != null) { + // add each feature, separately: + for (String feature : fs) { + features.add(feature.trim()); + } + } else { + features.add(f); + } } else { throw new ParsingException(parser.getTokenLocation(),