Skip to content

Commit 403720c

Browse files
committed
Fix mocks
1 parent 979203a commit 403720c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,12 @@ public Iterable<MappedFieldType> dimensionFields() {
437437
() -> query,
438438
null,
439439
maxBucket,
440-
() -> buildSubSearchContext(indexSettings, searchExecutionContext, bitsetFilterCache),
440+
() -> buildSubSearchContext(
441+
indexSettings,
442+
searchExecutionContext,
443+
bitsetFilterCache,
444+
breakerService.getBreaker(CircuitBreaker.REQUEST)
445+
),
441446
bitsetFilterCache,
442447
randomInt(),
443448
() -> 0L,
@@ -471,7 +476,8 @@ protected List<ObjectMapper> objectMappers() {
471476
private SubSearchContext buildSubSearchContext(
472477
IndexSettings indexSettings,
473478
SearchExecutionContext searchExecutionContext,
474-
BitsetFilterCache bitsetFilterCache
479+
BitsetFilterCache bitsetFilterCache,
480+
CircuitBreaker breaker
475481
) {
476482
SearchContext ctx = mock(SearchContext.class);
477483
try {
@@ -488,7 +494,8 @@ private SubSearchContext buildSubSearchContext(
488494
throw new RuntimeException(e);
489495
}
490496
when(ctx.fetchPhase()).thenReturn(new FetchPhase(Arrays.asList(new FetchSourcePhase(), new FetchDocValuesPhase())));
491-
497+
when(ctx.circuitBreaker()).thenReturn(breaker);
498+
when(ctx.memAccountingBufferSize()).thenReturn(1024 * 1024L);
492499
/*
493500
* Use a QueryShardContext that doesn't contain nested documents so we
494501
* don't try to fetch them which would require mocking a whole menagerie

0 commit comments

Comments
 (0)