diff --git a/core/src/test/java/org/elasticsearch/test/ESIntegTestCase.java b/core/src/test/java/org/elasticsearch/test/ESIntegTestCase.java index 5327f4e6325..9bb1cfd0cfb 100644 --- a/core/src/test/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/core/src/test/java/org/elasticsearch/test/ESIntegTestCase.java @@ -1739,7 +1739,7 @@ public abstract class ESIntegTestCase extends ESTestCase { throw new IllegalArgumentException("port is not valid, expected number but was [" + split[1] + "]"); } } - return new ExternalTestCluster(createTempDir(), externalClusterClientSettings(), transportAddresses); + return new ExternalTestCluster(createTempDir(), externalClusterClientSettings(), transportClientPlugins(), transportAddresses); } protected Settings externalClusterClientSettings() { diff --git a/core/src/test/java/org/elasticsearch/test/ExternalTestCluster.java b/core/src/test/java/org/elasticsearch/test/ExternalTestCluster.java index 9a919a391cb..90ca7818b9f 100644 --- a/core/src/test/java/org/elasticsearch/test/ExternalTestCluster.java +++ b/core/src/test/java/org/elasticsearch/test/ExternalTestCluster.java @@ -33,10 +33,12 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.node.internal.InternalSettingsPreparer; +import org.elasticsearch.plugins.Plugin; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.file.Path; +import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.concurrent.atomic.AtomicInteger; @@ -65,7 +67,7 @@ public final class ExternalTestCluster extends TestCluster { private final int numDataNodes; private final int numMasterAndDataNodes; - public ExternalTestCluster(Path tempDir, Settings additionalSettings, TransportAddress... transportAddresses) { + public ExternalTestCluster(Path tempDir, Settings additionalSettings, Collection> pluginClasses, TransportAddress... transportAddresses) { super(0); Settings clientSettings = Settings.settingsBuilder() .put(additionalSettings) @@ -75,7 +77,11 @@ public final class ExternalTestCluster extends TestCluster { .put("path.home", tempDir) .put("node.mode", "network").build(); // we require network here! - this.client = TransportClient.builder().settings(clientSettings).build().addTransportAddresses(transportAddresses); + TransportClient.Builder transportClientBuilder = TransportClient.builder().settings(clientSettings); + for (Class pluginClass : pluginClasses) { + transportClientBuilder.addPlugin(pluginClass); + } + this.client = transportClientBuilder.build().addTransportAddresses(transportAddresses); NodesInfoResponse nodeInfos = this.client.admin().cluster().prepareNodesInfo().clear().setSettings(true).setHttp(true).get(); httpAddresses = new InetSocketAddress[nodeInfos.getNodes().length];