From 3427062c3a9919c21e558dbe8bf6f899f078eb4f Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Tue, 21 Nov 2017 19:28:27 +0100 Subject: [PATCH] [Test] Fix AggregationsTests#testFromXContentWithRandomFields Exclude "key" field from random modifications in tests, the composite agg uses an array of object for bucket key and values are checked. Relates #26800 --- .../elasticsearch/search/aggregations/AggregationsTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/AggregationsTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/AggregationsTests.java index 55514fafc23..29c187f59a8 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/AggregationsTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/AggregationsTests.java @@ -220,12 +220,15 @@ public class AggregationsTests extends ESTestCase { * - we cannot insert randomly into VALUE or VALUES objects e.g. in Percentiles, the keys need to be numeric there * * - we cannot insert into ExtendedMatrixStats "covariance" or "correlation" fields, their syntax is strict + * + * - exclude "key", it can be an array of objects and we need strict values */ Predicate excludes = path -> (path.isEmpty() || path.endsWith("aggregations") || path.endsWith(Aggregation.CommonFields.META.getPreferredName()) || path.endsWith(Aggregation.CommonFields.BUCKETS.getPreferredName()) || path.endsWith(CommonFields.VALUES.getPreferredName()) || path.endsWith("covariance") || path.endsWith("correlation") - || path.contains(CommonFields.VALUE.getPreferredName())); + || path.contains(CommonFields.VALUE.getPreferredName()) + || path.endsWith(CommonFields.KEY.getPreferredName())); mutated = insertRandomFields(xContentType, originalBytes, excludes, random()); } else { mutated = originalBytes;