Remove upgrade source test, no longer needed with groovy gone
Original commit: elastic/x-pack-elasticsearch@c4a6c87227
This commit is contained in:
parent
1dc839bd98
commit
3f02111a92
|
@ -51,53 +51,4 @@ public class WatcherSearchTemplateRequestTests extends ESTestCase {
|
|||
fail("Failed to parse watch search request: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void testUpgradeSearchSource() throws IOException {
|
||||
XContentBuilder contentBuilder = jsonBuilder();
|
||||
contentBuilder.startObject();
|
||||
contentBuilder.startObject("body");
|
||||
|
||||
contentBuilder.startObject("query");
|
||||
contentBuilder.startObject("script");
|
||||
contentBuilder.startObject("script");
|
||||
contentBuilder.field("inline", "return true");
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
|
||||
contentBuilder.startObject("aggregations");
|
||||
contentBuilder.startObject("avg_grade");
|
||||
contentBuilder.startObject("avg");
|
||||
contentBuilder.startObject("script");
|
||||
contentBuilder.field("inline", "1 + 1");
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.startObject("another_avg");
|
||||
contentBuilder.startObject("avg");
|
||||
contentBuilder.startObject("script");
|
||||
contentBuilder.field("inline", "1 + 2");
|
||||
contentBuilder.field("lang", "javascript");
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
|
||||
contentBuilder.endObject();
|
||||
contentBuilder.endObject();
|
||||
XContentParser parser = XContentHelper.createParser(contentBuilder.bytes());
|
||||
parser.nextToken();
|
||||
|
||||
SearchRequestParsers searchRequestParsers = new SearchModule(Settings.EMPTY, false, Collections.emptyList())
|
||||
.getSearchRequestParsers();
|
||||
WatcherSearchTemplateRequest result = WatcherSearchTemplateRequest.fromXContent(
|
||||
logger, parser, SearchType.DEFAULT, ParseFieldMatcher.STRICT, searchRequestParsers);
|
||||
Map<String, Object> parsedResult = XContentHelper.convertToMap(result.getSearchSource(), true).v2();
|
||||
// after upgrading the language must be equal to legacy language, because no language was defined explicitly in these scripts:
|
||||
assertThat(XContentMapValues.extractValue("query.script.script.lang", parsedResult), equalTo("your_legacy_lang"));
|
||||
assertThat(XContentMapValues.extractValue("aggregations.avg_grade.avg.script.lang", parsedResult), equalTo("your_legacy_lang"));
|
||||
// after upgrading the language must remain javascript here, because that has been explicitly defined in the script:
|
||||
assertThat(XContentMapValues.extractValue("aggregations.another_avg.avg.script.lang", parsedResult), equalTo("javascript"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue