Skip to content

Commit

Permalink
fixed mocking of transport service
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <[email protected]>
  • Loading branch information
amitgalitz committed Oct 5, 2023
1 parent 42ce1b9 commit aca627d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/test/java/org/opensearch/ad/task/ADTaskManagerTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@
import org.opensearch.search.SearchHits;
import org.opensearch.search.aggregations.InternalAggregations;
import org.opensearch.search.internal.InternalSearchResponse;
import org.opensearch.telemetry.tracing.noop.NoopTracer;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.Transport;
import org.opensearch.transport.TransportResponseHandler;
import org.opensearch.transport.TransportService;

Expand Down Expand Up @@ -233,7 +235,16 @@ public void setUp() throws Exception {
detectionIndices = mock(AnomalyDetectionIndices.class);
adTaskCacheManager = mock(ADTaskCacheManager.class);
hashRing = mock(HashRing.class);
transportService = mock(TransportService.class);
transportService = new TransportService(
Settings.EMPTY,
mock(Transport.class),
null,
TransportService.NOOP_TRANSPORT_INTERCEPTOR,
x -> null,
null,
Collections.emptySet(),
NoopTracer.INSTANCE
);
threadPool = mock(ThreadPool.class);
threadContext = new ThreadContext(settings);
when(threadPool.getThreadContext()).thenReturn(threadContext);
Expand Down

0 comments on commit aca627d

Please sign in to comment.