diff --git a/server/src/test/java/org/elasticsearch/index/query/IntervalQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/IntervalQueryBuilderTests.java index 5fd91848a70..7b004db65da 100644 --- a/server/src/test/java/org/elasticsearch/index/query/IntervalQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/IntervalQueryBuilderTests.java @@ -52,7 +52,7 @@ public class IntervalQueryBuilderTests extends AbstractQueryTestCase 3) { - return createRandomMatch(depth + 1); + return createRandomMatch(depth + 1, useScripts); } switch (randomInt(20)) { case 0: @@ -94,29 +94,29 @@ public class IntervalQueryBuilderTests extends AbstractQueryTestCase orSources = new ArrayList<>(); for (int i = 0; i < orCount; i++) { - orSources.add(createRandomSource(depth + 1)); + orSources.add(createRandomSource(depth + 1, useScripts)); } - return new IntervalsSourceProvider.Disjunction(orSources, createRandomFilter(depth + 1)); + return new IntervalsSourceProvider.Disjunction(orSources, createRandomFilter(depth + 1, useScripts)); case 2: case 3: int count = randomInt(5) + 1; List subSources = new ArrayList<>(); for (int i = 0; i < count; i++) { - subSources.add(createRandomSource(depth + 1)); + subSources.add(createRandomSource(depth + 1, useScripts)); } boolean ordered = randomBoolean(); int maxGaps = randomInt(5) - 1; - IntervalsSourceProvider.IntervalFilter filter = createRandomFilter(depth + 1); + IntervalsSourceProvider.IntervalFilter filter = createRandomFilter(depth + 1, useScripts); return new IntervalsSourceProvider.Combine(subSources, ordered, maxGaps, filter); default: - return createRandomMatch(depth + 1); + return createRandomMatch(depth + 1, useScripts); } } - private IntervalsSourceProvider.IntervalFilter createRandomFilter(int depth) { + private IntervalsSourceProvider.IntervalFilter createRandomFilter(int depth, boolean useScripts) { if (depth < 3 && randomInt(20) > 18) { - if (randomBoolean()) { - return new IntervalsSourceProvider.IntervalFilter(createRandomSource(depth + 1), randomFrom(filters)); + if (useScripts == false || randomBoolean()) { + return new IntervalsSourceProvider.IntervalFilter(createRandomSource(depth + 1, false), randomFrom(filters)); } return new IntervalsSourceProvider.IntervalFilter( new Script(ScriptType.INLINE, "mockscript", "1", Collections.emptyMap())); @@ -124,7 +124,7 @@ public class IntervalQueryBuilderTests extends AbstractQueryTestCase words = new ArrayList<>(); @@ -135,7 +135,25 @@ public class IntervalQueryBuilderTests extends AbstractQueryTestCase