|
11 | 11 | import org.apache.lucene.sandbox.document.HalfFloatPoint; |
12 | 12 | import org.apache.lucene.util.BytesRef; |
13 | 13 | import org.elasticsearch.ExceptionsHelper; |
| 14 | +import org.elasticsearch.action.ActionListener; |
14 | 15 | import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; |
15 | 16 | import org.elasticsearch.cluster.service.ClusterService; |
16 | 17 | import org.elasticsearch.common.Strings; |
|
149 | 150 | import static org.hamcrest.Matchers.instanceOf; |
150 | 151 | import static org.junit.Assert.assertNotNull; |
151 | 152 | import static org.junit.Assert.assertNull; |
| 153 | +import static org.mockito.ArgumentMatchers.any; |
| 154 | +import static org.mockito.Mockito.doAnswer; |
152 | 155 | import static org.mockito.Mockito.mock; |
153 | 156 |
|
154 | 157 | public final class EsqlTestUtils { |
@@ -377,9 +380,22 @@ public static LogicalOptimizerContext unboundLogicalOptimizerContext() { |
377 | 380 | mock(ClusterService.class), |
378 | 381 | mock(IndexNameExpressionResolver.class), |
379 | 382 | null, |
380 | | - mock(InferenceService.class) |
| 383 | + mockInferenceService() |
381 | 384 | ); |
382 | 385 |
|
| 386 | + @SuppressWarnings("unchecked") |
| 387 | + private static InferenceService mockInferenceService() { |
| 388 | + InferenceService inferenceService = mock(InferenceService.class); |
| 389 | + doAnswer( |
| 390 | + i -> { |
| 391 | + i.getArgument(1, ActionListener.class).onResponse(emptyInferenceResolution()); |
| 392 | + return null; |
| 393 | + } |
| 394 | + ).when(inferenceService).resolveInferences(any(), any()); |
| 395 | + |
| 396 | + return inferenceService; |
| 397 | + } |
| 398 | + |
383 | 399 | private EsqlTestUtils() {} |
384 | 400 |
|
385 | 401 | public static Configuration configuration(QueryPragmas pragmas, String query) { |
|
0 commit comments