Fix nested agg test
I accidentally allowed the test framework to double-wrap a reader that we rely on being only singly wrapped. Lame. closes #56529
This commit is contained in:
parent
91c5ace569
commit
c85a363b60
|
@ -555,8 +555,14 @@ public abstract class AggregatorTestCase extends ESTestCase {
|
||||||
buildIndex.accept(indexWriter);
|
buildIndex.accept(indexWriter);
|
||||||
indexWriter.close();
|
indexWriter.close();
|
||||||
|
|
||||||
try (IndexReader indexReader = wrapDirectoryReader(DirectoryReader.open(directory))) {
|
try (DirectoryReader unwrapped = DirectoryReader.open(directory);
|
||||||
IndexSearcher indexSearcher = newSearcher(indexReader, true, true);
|
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);
|
||||||
|
|
||||||
V agg = searchAndReduce(indexSearcher, query, aggregationBuilder, fieldTypes);
|
V agg = searchAndReduce(indexSearcher, query, aggregationBuilder, fieldTypes);
|
||||||
verify.accept(agg);
|
verify.accept(agg);
|
||||||
|
|
Loading…
Reference in New Issue