Skip to content

Commit b71ecd6

Browse files
CR comments
1 parent 581f7bf commit b71ecd6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/framework/src/main/java/org/elasticsearch/search/ErrorTraceHelper.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.util.concurrent.atomic.AtomicBoolean;
2020
import java.util.function.BooleanSupplier;
2121

22+
import static org.elasticsearch.test.ESTestCase.asInstanceOf;
23+
2224
/**
2325
* Utilities around testing the `error_trace` message header in search.
2426
*/
@@ -28,7 +30,7 @@ public enum ErrorTraceHelper {
2830
public static BooleanSupplier setupErrorTraceListener(InternalTestCluster internalCluster) {
2931
final AtomicBoolean transportMessageHasStackTrace = new AtomicBoolean(false);
3032
internalCluster.getDataNodeInstances(TransportService.class)
31-
.forEach(ts -> ((MockTransportService) ts).addMessageListener(new TransportMessageListener() {
33+
.forEach(ts -> asInstanceOf(MockTransportService.class, ts).addMessageListener(new TransportMessageListener() {
3234
@Override
3335
public void onResponseSent(long requestId, String action, Exception error) {
3436
TransportMessageListener.super.onResponseSent(requestId, action, error);

x-pack/plugin/async-search/src/internalClusterTest/java/org/elasticsearch/xpack/search/AsyncSearchErrorTraceIT.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import org.elasticsearch.client.Request;
1111
import org.elasticsearch.client.Response;
12+
import org.elasticsearch.common.util.CollectionUtils;
1213
import org.elasticsearch.common.xcontent.XContentHelper;
1314
import org.elasticsearch.core.TimeValue;
1415
import org.elasticsearch.plugins.Plugin;
@@ -20,7 +21,6 @@
2021

2122
import java.io.IOException;
2223
import java.util.Collection;
23-
import java.util.List;
2424
import java.util.Map;
2525
import java.util.function.BooleanSupplier;
2626

@@ -32,8 +32,9 @@ protected boolean addMockHttpTransport() {
3232
}
3333

3434
@Override
35+
@SuppressWarnings("unchecked")
3536
protected Collection<Class<? extends Plugin>> nodePlugins() {
36-
return List.of(AsyncSearch.class, MockTransportService.TestPlugin.class);
37+
return CollectionUtils.appendToCopyNoNullElements(super.nodePlugins(), AsyncSearch.class, MockTransportService.TestPlugin.class);
3738
}
3839

3940
private BooleanSupplier transportMessageHasStackTrace;

0 commit comments

Comments
 (0)