Skip to content

Commit

Permalink
Fix DateHistogramAggregatorTests.testAsSubAgg
Browse files Browse the repository at this point in the history
Closes #57168 by using `AggregatorTestCase#newIndexSearcher` in the
`AggregatorTestCase#testCase`. Without that global ordinals will
*sometimes* fail to work.
  • Loading branch information
nik9000 committed May 26, 2020
1 parent 92e127e commit 0fce2b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public void testMatchAllDocs() throws IOException {
);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/57168")
public void testAsSubAgg() throws IOException {
KeywordFieldMapper.KeywordFieldType k1ft = new KeywordFieldMapper.KeywordFieldType();
k1ft.setName("k1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,7 @@ protected <T extends AggregationBuilder, V extends InternalAggregation> void tes

try (DirectoryReader unwrapped = DirectoryReader.open(directory);
IndexReader indexReader = wrapDirectoryReader(unwrapped)) {
/*
* Only allow the randomized testing to wrap the reader if
* the test didn't explicitly wrap the reader.
*/
boolean maybeWrap = unwrapped == indexReader;
IndexSearcher indexSearcher = newSearcher(indexReader, maybeWrap, true);
IndexSearcher indexSearcher = newIndexSearcher(indexReader);

V agg = searchAndReduce(indexSearcher, query, aggregationBuilder, fieldTypes);
verify.accept(agg);
Expand Down

0 comments on commit 0fce2b7

Please sign in to comment.