Skip to content

Commit

Permalink
IntervalQueryBuilderTests#testNonIndexedFields test fix (elastic#40418)
Browse files Browse the repository at this point in the history
This test checks that interval queries constructed against a field with no indexed
positions will throw exceptions. It uses a randomly-build IntervalsSourceProvider
against a fixed set of fields; however, the random source builder can occasionally
provide a source with a fixed field, meaning that even if the top-level query asks
for a set of intervals over a non-indexed field, the source will delegate to another
field, and no exception will be thrown.

This commit changes the test to always use a simple Match provider.
  • Loading branch information
romseygeek authored Mar 26, 2019
1 parent 68b94ba commit d5015c1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public void testCombineDisjunctionInterval() throws IOException {
}

public void testNonIndexedFields() throws IOException {
IntervalsSourceProvider provider = createRandomSource();
IntervalsSourceProvider provider = new IntervalsSourceProvider.Match("test", 0, true, null, null, null);
IntervalQueryBuilder b = new IntervalQueryBuilder("no_such_field", provider);
assertThat(b.toQuery(createShardContext()), equalTo(new MatchNoDocsQuery()));

Expand Down

0 comments on commit d5015c1

Please sign in to comment.