Pass classpath plugins to tribe nodes
When testing tribe nodes in an integration test, we should pass the classpath plugins of the node down to the tribe client nodes. Without this the tribe client nodes could be prevented from communicating with the tribes.
This commit is contained in:
parent
ad7c22198c
commit
0573e03aa1
|
@ -315,7 +315,7 @@ public class Node implements Closeable {
|
|||
final ClusterService clusterService = new ClusterService(settings, settingsModule.getClusterSettings(), threadPool);
|
||||
clusterService.add(scriptModule.getScriptService());
|
||||
resourcesToClose.add(clusterService);
|
||||
final TribeService tribeService = new TribeService(settings, clusterService, nodeEnvironment.nodeId());
|
||||
final TribeService tribeService = new TribeService(settings, clusterService, nodeEnvironment.nodeId(), classpathPlugins);
|
||||
resourcesToClose.add(tribeService);
|
||||
final IngestService ingestService = new IngestService(settings, threadPool, this.environment,
|
||||
scriptModule.getScriptService(), analysisModule.getAnalysisRegistry(), pluginsService.filterPlugins(IngestPlugin.class));
|
||||
|
|
|
@ -24,13 +24,13 @@ import org.elasticsearch.env.Environment;
|
|||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* An internal node that connects to a remove cluster, as part of a tribe node.
|
||||
*/
|
||||
class TribeClientNode extends Node {
|
||||
TribeClientNode(Settings settings) {
|
||||
super(new Environment(settings), Collections.<Class<? extends Plugin>>emptyList());
|
||||
TribeClientNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
|
||||
super(new Environment(settings), classpathPlugins);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,10 +58,12 @@ import org.elasticsearch.env.Environment;
|
|||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.gateway.GatewayService;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.transport.TransportSettings;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
@ -182,7 +184,8 @@ public class TribeService extends AbstractLifecycleComponent {
|
|||
|
||||
private final List<Node> nodes = new CopyOnWriteArrayList<>();
|
||||
|
||||
public TribeService(Settings settings, ClusterService clusterService, final String tribeNodeId) {
|
||||
public TribeService(Settings settings, ClusterService clusterService, final String tribeNodeId,
|
||||
Collection<Class<? extends Plugin>> classpathPlugins) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
Map<String, Settings> nodesSettings = new HashMap<>(settings.getGroups("tribe", true));
|
||||
|
@ -190,7 +193,7 @@ public class TribeService extends AbstractLifecycleComponent {
|
|||
nodesSettings.remove("on_conflict"); // remove prefix settings that don't indicate a client
|
||||
for (Map.Entry<String, Settings> entry : nodesSettings.entrySet()) {
|
||||
Settings clientSettings = buildClientSettings(entry.getKey(), tribeNodeId, settings, entry.getValue());
|
||||
nodes.add(new TribeClientNode(clientSettings));
|
||||
nodes.add(new TribeClientNode(clientSettings, classpathPlugins));
|
||||
}
|
||||
|
||||
this.blockIndicesMetadata = BLOCKS_METADATA_INDICES_SETTING.get(settings).toArray(Strings.EMPTY_ARRAY);
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.junit.BeforeClass;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.either;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
@ -71,14 +72,14 @@ public class TribeUnitTests extends ESTestCase {
|
|||
.put("cluster.name", "tribe1")
|
||||
.put("node.name", "tribe1_node")
|
||||
.put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), random().nextLong())
|
||||
.build()).start();
|
||||
.build(), Collections.emptyList()).start();
|
||||
tribe2 = new TribeClientNode(
|
||||
Settings.builder()
|
||||
.put(baseSettings)
|
||||
.put("cluster.name", "tribe2")
|
||||
.put("node.name", "tribe2_node")
|
||||
.put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), random().nextLong())
|
||||
.build()).start();
|
||||
.build(), Collections.emptyList()).start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
Loading…
Reference in New Issue