From aca627d329d15c9a3c58c984dd91086f96c5c6b3 Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Thu, 5 Oct 2023 11:05:44 -0700 Subject: [PATCH] fixed mocking of transport service Signed-off-by: Amit Galitzky --- .../org/opensearch/ad/task/ADTaskManagerTests.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/opensearch/ad/task/ADTaskManagerTests.java b/src/test/java/org/opensearch/ad/task/ADTaskManagerTests.java index 69f77b851..08645a279 100644 --- a/src/test/java/org/opensearch/ad/task/ADTaskManagerTests.java +++ b/src/test/java/org/opensearch/ad/task/ADTaskManagerTests.java @@ -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; @@ -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);