|
39 | 39 | import org.elasticsearch.test.ESTestCase; |
40 | 40 | import org.elasticsearch.test.InternalAggregationTestCase; |
41 | 41 | import org.elasticsearch.transport.Transport; |
| 42 | +import org.elasticsearch.transport.TransportService; |
42 | 43 |
|
43 | 44 | import java.util.Collections; |
44 | 45 | import java.util.List; |
|
51 | 52 | import static org.hamcrest.Matchers.equalTo; |
52 | 53 | import static org.hamcrest.Matchers.greaterThanOrEqualTo; |
53 | 54 | import static org.hamcrest.Matchers.instanceOf; |
| 55 | +import static org.mockito.Mockito.mock; |
| 56 | +import static org.mockito.Mockito.when; |
54 | 57 |
|
55 | 58 | public class SearchQueryThenFetchAsyncActionTests extends ESTestCase { |
56 | 59 | public void testBottomFieldSort() throws Exception { |
@@ -83,7 +86,9 @@ private void testCase(boolean withScroll, boolean withCollapse) throws Exception |
83 | 86 | AtomicInteger numWithTopDocs = new AtomicInteger(); |
84 | 87 | AtomicInteger successfulOps = new AtomicInteger(); |
85 | 88 | AtomicBoolean canReturnNullResponse = new AtomicBoolean(false); |
86 | | - SearchTransportService searchTransportService = new SearchTransportService(null, null, null) { |
| 89 | + var transportService = mock(TransportService.class); |
| 90 | + when(transportService.getLocalNode()).thenReturn(primaryNode); |
| 91 | + SearchTransportService searchTransportService = new SearchTransportService(transportService, null, null) { |
87 | 92 | @Override |
88 | 93 | public void sendExecuteQuery( |
89 | 94 | Transport.Connection connection, |
|
0 commit comments