Adapt to node.client setting removal
We would previosly check if a node was a client node, we can now check it by just verifying that it is not a transport client through client_type setting. Original commit: elastic/x-pack-elasticsearch@bddd44866e
This commit is contained in:
parent
c1c78911b9
commit
30a7ff1daa
|
@ -8,7 +8,6 @@ package org.elasticsearch.license.plugin;
|
|||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.Module;
|
||||
|
@ -44,13 +43,8 @@ public class Licensing {
|
|||
|
||||
@Inject
|
||||
public Licensing(Settings settings) {
|
||||
if (DiscoveryNode.clientNode(settings)) {
|
||||
// Enable plugin only on node clients
|
||||
this.isEnabled = "node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||
} else {
|
||||
this.isEnabled = true;
|
||||
}
|
||||
transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||
this.transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||
isEnabled = transportClient == false;
|
||||
}
|
||||
|
||||
public void onModule(NetworkModule module) {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
package org.elasticsearch.license.plugin.consumer;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -21,12 +20,7 @@ public abstract class TestConsumerPluginBase extends Plugin {
|
|||
private final boolean isEnabled;
|
||||
|
||||
public TestConsumerPluginBase(Settings settings) {
|
||||
if (DiscoveryNode.clientNode(settings)) {
|
||||
// Enable plugin only on node clients
|
||||
this.isEnabled = "node".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||
} else {
|
||||
this.isEnabled = true;
|
||||
}
|
||||
this.isEnabled = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())) == false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.test.MarvelIntegTestCase;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
|
||||
|
@ -63,7 +64,8 @@ public class MultiNodesStatsTests extends MarvelIntegTestCase {
|
|||
n = randomIntBetween(1, 2);
|
||||
logger.debug("--> starting {} client only nodes", n);
|
||||
InternalTestCluster.Async<List<String>> clientNodes = internalCluster().startNodesAsync(n,
|
||||
settingsBuilder().put("node.client", true).build());
|
||||
settingsBuilder().put(Node.NODE_DATA_SETTING.getKey(), false).put(Node.NODE_MASTER_SETTING.getKey(), false)
|
||||
.put(Node.NODE_INGEST_SETTING.getKey(), false).build());
|
||||
clientNodes.get();
|
||||
nodes += n;
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.elasticsearch.node.Node;
|
|||
import org.elasticsearch.shield.authc.esusers.ESUsersRealm;
|
||||
import org.elasticsearch.shield.crypto.InternalCryptoService;
|
||||
import org.elasticsearch.test.ShieldIntegTestCase;
|
||||
import org.elasticsearch.test.ShieldSettingsSource;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
import org.elasticsearch.xpack.XPackPlugin;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -27,7 +26,7 @@ import java.io.IOException;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
|
||||
|
@ -103,9 +102,8 @@ public class ServerTransportFilterIntegrationTests extends ShieldIntegTestCase {
|
|||
.put("path.home", createTempDir())
|
||||
.put(NetworkModule.HTTP_ENABLED.getKey(), false)
|
||||
.put(InternalCryptoService.FILE_SETTING, systemKeyFile)
|
||||
.put("node.client", true)
|
||||
.build();
|
||||
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Arrays.asList(XPackPlugin.class))) {
|
||||
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Collections.singletonList(XPackPlugin.class))) {
|
||||
node.start();
|
||||
assertGreenClusterState(node.client());
|
||||
}
|
||||
|
@ -136,9 +134,9 @@ public class ServerTransportFilterIntegrationTests extends ShieldIntegTestCase {
|
|||
.put(InternalCryptoService.FILE_SETTING, systemKeyFile)
|
||||
.put("discovery.initial_state_timeout", "2s")
|
||||
.put("path.home", createTempDir())
|
||||
.put("node.client", true)
|
||||
.put(Node.NODE_MASTER_SETTING.getKey(), false)
|
||||
.build();
|
||||
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Arrays.asList(XPackPlugin.class))) {
|
||||
try (Node node = new MockNode(nodeSettings, Version.CURRENT, Collections.singletonList(XPackPlugin.class))) {
|
||||
node.start();
|
||||
|
||||
// assert that node is not connected by waiting for the timeout
|
||||
|
|
Loading…
Reference in New Issue