diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java index 296a2ec4611..aa23dfdb7a5 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java @@ -180,9 +180,9 @@ public abstract class AggregatorTestCase extends ESTestCase { if (aggs.isEmpty()) { return null; } else { - if (aggs.size() > 2 && randomBoolean()) { + if (randomBoolean()) { // sometimes do an incremental reduce - List internalAggregations = randomSubsetOf(randomIntBetween(2, aggs.size()-1), aggs); + List internalAggregations = randomSubsetOf(randomIntBetween(1, aggs.size()), aggs); A internalAgg = (A) aggs.get(0).doReduce(internalAggregations, new InternalAggregation.ReduceContext(root.context().bigArrays(), null, false)); aggs.removeAll(internalAggregations); diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationTestCase.java b/core/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationTestCase.java index f7d105ac8da..502767e07bf 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationTestCase.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationTestCase.java @@ -57,8 +57,9 @@ public abstract class InternalAggregationTestCase inputs.add(t); toReduce.add(t); } - if (randomBoolean() && toReduceSize >= 2) { - List internalAggregations = randomSubsetOf(randomIntBetween(2, toReduceSize - 2), toReduce); + if (randomBoolean()) { + // we leave at least one in the list + List internalAggregations = randomSubsetOf(randomIntBetween(1, toReduceSize), toReduce); InternalAggregation.ReduceContext context = new InternalAggregation.ReduceContext(null, null, true); @SuppressWarnings("unchecked") T reduced = (T) inputs.get(0).reduce(internalAggregations, context); diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStatsTests.java b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStatsTests.java index 73b1ad914d7..83e1815f398 100644 --- a/core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStatsTests.java +++ b/core/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStatsTests.java @@ -30,7 +30,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public class InternalExtendedStatsTests extends InternalAggregationTestCase { +public class InternalExtendedStatsTests extends InternalAggregationTestCase { private double sigma; @Before