Remove DiscoveryPlugin#getDiscoveryTypes (#38414)
With this change we no longer support pluggable discovery implementations. No known implementations of `DiscoveryPlugin` actually override this method, so in practice this should have no effect on the wider world. However, we were using this rather extensively in tests to provide the `test-zen` discovery type. We no longer need a separate discovery type for tests as we no longer need to customise its behaviour. Relates #38410
This commit is contained in:
parent
963b474f2f
commit
f2dd5dd6eb
|
@ -70,3 +70,8 @@ The `RealmSettings.simpleString` method can be used as a convenience for the abo
|
|||
Tribe node functionality has been removed in favor of
|
||||
<<modules-cross-cluster-search,Cross Cluster Search>>.
|
||||
|
||||
[float]
|
||||
==== Discovery implementations are no longer pluggable
|
||||
|
||||
* The method `DiscoveryPlugin#getDiscoveryTypes()` was removed, so that plugins
|
||||
can no longer provide their own discovery implementations.
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.http.HttpServerTransport;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.InternalTestCluster;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -51,11 +50,6 @@ import static org.hamcrest.core.Is.is;
|
|||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, transportClientRatio = 0, autoMinMasterNodes = false)
|
||||
public class Zen2RestApiIT extends ESNetty4IntegTestCase {
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(TestZenDiscovery.USE_ZEN2.getKey(), true).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean addMockHttpTransport() {
|
||||
return false; // enable http
|
||||
|
|
|
@ -55,6 +55,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
@ -69,8 +70,8 @@ import static org.elasticsearch.node.Node.NODE_NAME_SETTING;
|
|||
public class DiscoveryModule {
|
||||
private static final Logger logger = LogManager.getLogger(DiscoveryModule.class);
|
||||
|
||||
public static final String ZEN_DISCOVERY_TYPE = "zen";
|
||||
public static final String ZEN2_DISCOVERY_TYPE = "zen2";
|
||||
public static final String ZEN_DISCOVERY_TYPE = "legacy-zen";
|
||||
public static final String ZEN2_DISCOVERY_TYPE = "zen";
|
||||
|
||||
public static final Setting<String> DISCOVERY_TYPE_SETTING =
|
||||
new Setting<>("discovery.type", ZEN2_DISCOVERY_TYPE, Function.identity(), Property.NodeScope);
|
||||
|
@ -136,17 +137,9 @@ public class DiscoveryModule {
|
|||
discoveryTypes.put(ZEN2_DISCOVERY_TYPE, () -> new Coordinator(NODE_NAME_SETTING.get(settings), settings, clusterSettings,
|
||||
transportService, namedWriteableRegistry, allocationService, masterService,
|
||||
() -> gatewayMetaState.getPersistedState(settings, (ClusterApplierService) clusterApplier), hostsProvider, clusterApplier,
|
||||
joinValidators, Randomness.get()));
|
||||
joinValidators, new Random(Randomness.get().nextLong())));
|
||||
discoveryTypes.put("single-node", () -> new SingleNodeDiscovery(settings, transportService, masterService, clusterApplier,
|
||||
gatewayMetaState));
|
||||
for (DiscoveryPlugin plugin : plugins) {
|
||||
plugin.getDiscoveryTypes(threadPool, transportService, namedWriteableRegistry, masterService, clusterApplier, clusterSettings,
|
||||
hostsProvider, allocationService, gatewayMetaState).forEach((key, value) -> {
|
||||
if (discoveryTypes.put(key, value) != null) {
|
||||
throw new IllegalArgumentException("Cannot register discovery type [" + key + "] twice");
|
||||
}
|
||||
});
|
||||
}
|
||||
String discoveryType = DISCOVERY_TYPE_SETTING.get(settings);
|
||||
Supplier<Discovery> discoverySupplier = discoveryTypes.get(discoveryType);
|
||||
if (discoverySupplier == null) {
|
||||
|
|
|
@ -19,26 +19,18 @@
|
|||
|
||||
package org.elasticsearch.plugins;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
||||
import org.elasticsearch.cluster.service.ClusterApplier;
|
||||
import org.elasticsearch.cluster.service.MasterService;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
|
||||
import org.elasticsearch.gateway.GatewayMetaState;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
/**
|
||||
* An additional extension point for {@link Plugin}s that extends Elasticsearch's discovery functionality. To add an additional
|
||||
* {@link NetworkService.CustomNameResolver} just implement the interface and implement the {@link #getCustomNameResolver(Settings)} method:
|
||||
|
@ -53,32 +45,6 @@ import org.elasticsearch.transport.TransportService;
|
|||
* }</pre>
|
||||
*/
|
||||
public interface DiscoveryPlugin {
|
||||
|
||||
/**
|
||||
* Returns custom discovery implementations added by this plugin.
|
||||
*
|
||||
* The key of the returned map is the name of the discovery implementation
|
||||
* (see {@link org.elasticsearch.discovery.DiscoveryModule#DISCOVERY_TYPE_SETTING}, and
|
||||
* the value is a supplier to construct the {@link Discovery}.
|
||||
*
|
||||
* @param threadPool Use to schedule ping actions
|
||||
* @param transportService Use to communicate with other nodes
|
||||
* @param masterService Use to submit cluster state update tasks
|
||||
* @param clusterApplier Use to locally apply cluster state updates
|
||||
* @param clusterSettings Use to get cluster settings
|
||||
* @param hostsProvider Use to find configured hosts which should be pinged for initial discovery
|
||||
*/
|
||||
default Map<String, Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService,
|
||||
NamedWriteableRegistry namedWriteableRegistry,
|
||||
MasterService masterService,
|
||||
ClusterApplier clusterApplier,
|
||||
ClusterSettings clusterSettings,
|
||||
UnicastHostsProvider hostsProvider,
|
||||
AllocationService allocationService,
|
||||
GatewayMetaState gatewayMetaState) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to add additional {@link NetworkService.CustomNameResolver}s.
|
||||
* This can be handy if you want to provide your own Network interface name like _mycard_
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.index.IndexResponse;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption.NetworkDisconnect;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption.TwoPartitions;
|
||||
|
@ -50,12 +49,6 @@ public class IndexingMasterFailoverIT extends ESIntegTestCase {
|
|||
return classes;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexing operations which entail mapping changes require a blocking request to the master node to update the mapping.
|
||||
* If the master node is being disrupted or if it cannot commit cluster state changes, it needs to retry within timeout limits.
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.test.ESIntegTestCase;
|
|||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
import org.elasticsearch.test.MockHttpTransport;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.transport.MockTransportClient;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -66,10 +65,8 @@ public class TransportClientIT extends ESIntegTestCase {
|
|||
.put("transport.type", getTestTransportType())
|
||||
.put(Node.NODE_DATA_SETTING.getKey(), false)
|
||||
.put("cluster.name", "foobar")
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), getUseZen2())
|
||||
.putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey(), "testNodeVersionIsUpdated")
|
||||
.build(), Arrays.asList(getTestTransportPlugin(), TestZenDiscovery.TestPlugin.class,
|
||||
MockHttpTransport.TestPlugin.class)).start()) {
|
||||
.build(), Arrays.asList(getTestTransportPlugin(), MockHttpTransport.TestPlugin.class)).start()) {
|
||||
TransportAddress transportAddress = node.injector().getInstance(TransportService.class).boundAddress().publishAddress();
|
||||
client.addTransportAddress(transportAddress);
|
||||
// since we force transport clients there has to be one node started that we connect to.
|
||||
|
|
|
@ -49,7 +49,6 @@ import org.elasticsearch.index.mapper.DocumentMapper;
|
|||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.BlockClusterStateProcessing;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
|
||||
|
@ -71,12 +70,6 @@ import static org.hamcrest.Matchers.instanceOf;
|
|||
@TestLogging("_root:DEBUG")
|
||||
public class RareClusterStateIT extends ESIntegTestCase {
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int numberOfShards() {
|
||||
return 1;
|
||||
|
|
|
@ -37,13 +37,13 @@ import org.elasticsearch.common.Priority;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
import org.elasticsearch.discovery.DiscoveryModule;
|
||||
import org.elasticsearch.discovery.zen.ElectMasterService;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.gateway.MetaStateService;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.InternalTestCluster.RestartCallback;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -71,12 +71,10 @@ import static org.hamcrest.Matchers.is;
|
|||
public class Zen1IT extends ESIntegTestCase {
|
||||
|
||||
private static Settings ZEN1_SETTINGS = Coordinator.addZen1Attribute(true, Settings.builder()
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), false)
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false)) // Zen2 does not know about mock pings
|
||||
.build();
|
||||
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.ZEN_DISCOVERY_TYPE)).build();
|
||||
|
||||
private static Settings ZEN2_SETTINGS = Settings.builder()
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), true)
|
||||
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.ZEN2_DISCOVERY_TYPE)
|
||||
.build();
|
||||
|
||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||
|
|
|
@ -47,7 +47,6 @@ import org.elasticsearch.indices.IndicesService;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.InternalTestCluster;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption.NetworkDisconnect;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption.TwoPartitions;
|
||||
|
@ -88,12 +87,6 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
return Arrays.asList(MockTransportService.TestPlugin.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false).build();
|
||||
}
|
||||
|
||||
public void testBulkWeirdScenario() throws Exception {
|
||||
String master = internalCluster().startMasterOnlyNode(Settings.EMPTY);
|
||||
internalCluster().startDataOnlyNodes(2);
|
||||
|
|
|
@ -30,12 +30,9 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
|
|||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.zen.UnicastZenPing;
|
||||
import org.elasticsearch.discovery.zen.ZenPing;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.InternalTestCluster;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption.Bridge;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption.DisruptedLinks;
|
||||
|
@ -65,8 +62,7 @@ public abstract class AbstractDisruptionTestCase extends ESIntegTestCase {
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(DEFAULT_SETTINGS)
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false).build();
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(DEFAULT_SETTINGS).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,22 +110,9 @@ public abstract class AbstractDisruptionTestCase extends ESIntegTestCase {
|
|||
InternalTestCluster internalCluster = internalCluster();
|
||||
List<String> nodes = internalCluster.startNodes(numberOfNodes);
|
||||
ensureStableCluster(numberOfNodes);
|
||||
|
||||
// TODO: this is a temporary solution so that nodes will not base their reaction to a partition based on previous successful results
|
||||
clearTemporalResponses();
|
||||
return nodes;
|
||||
}
|
||||
|
||||
protected void clearTemporalResponses() {
|
||||
final Discovery discovery = internalCluster().getInstance(Discovery.class);
|
||||
if (discovery instanceof TestZenDiscovery) {
|
||||
ZenPing zenPing = ((TestZenDiscovery) discovery).getZenPing();
|
||||
if (zenPing instanceof UnicastZenPing) {
|
||||
((UnicastZenPing) zenPing).clearTemporalResponses();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final Settings DEFAULT_SETTINGS = Settings.builder()
|
||||
.put(LeaderChecker.LEADER_CHECK_TIMEOUT_SETTING.getKey(), "1s") // for hitting simulated network failures quickly
|
||||
.put(LeaderChecker.LEADER_CHECK_RETRY_COUNT_SETTING.getKey(), 1) // for hitting simulated network failures quickly
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.Version;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.coordination.Coordinator;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
||||
import org.elasticsearch.cluster.service.ClusterApplier;
|
||||
import org.elasticsearch.cluster.service.MasterService;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
|
@ -36,7 +35,6 @@ import org.elasticsearch.discovery.zen.ZenDiscovery;
|
|||
import org.elasticsearch.gateway.GatewayMetaState;
|
||||
import org.elasticsearch.plugins.DiscoveryPlugin;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.NoopDiscovery;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
@ -75,18 +73,6 @@ public class DiscoveryModuleTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public interface DummyDiscoveryPlugin extends DiscoveryPlugin {
|
||||
Map<String, Supplier<Discovery>> impl();
|
||||
@Override
|
||||
default Map<String, Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService,
|
||||
NamedWriteableRegistry namedWriteableRegistry,
|
||||
MasterService masterService, ClusterApplier clusterApplier,
|
||||
ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider,
|
||||
AllocationService allocationService, GatewayMetaState gatewayMetaState) {
|
||||
return impl();
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setupDummyServices() {
|
||||
threadPool = mock(ThreadPool.class);
|
||||
|
@ -114,19 +100,6 @@ public class DiscoveryModuleTests extends ESTestCase {
|
|||
assertTrue(module.getDiscovery() instanceof Coordinator);
|
||||
}
|
||||
|
||||
public void testLazyConstructionDiscovery() {
|
||||
DummyDiscoveryPlugin plugin = () -> Collections.singletonMap("custom",
|
||||
() -> { throw new AssertionError("created discovery type which was not selected"); });
|
||||
newModule(Settings.EMPTY, Collections.singletonList(plugin));
|
||||
}
|
||||
|
||||
public void testRegisterDiscovery() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "custom").build();
|
||||
DummyDiscoveryPlugin plugin = () -> Collections.singletonMap("custom", NoopDiscovery::new);
|
||||
DiscoveryModule module = newModule(settings, Collections.singletonList(plugin));
|
||||
assertTrue(module.getDiscovery() instanceof NoopDiscovery);
|
||||
}
|
||||
|
||||
public void testUnknownDiscovery() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "dne").build();
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
|
||||
|
@ -134,14 +107,6 @@ public class DiscoveryModuleTests extends ESTestCase {
|
|||
assertEquals("Unknown discovery type [dne]", e.getMessage());
|
||||
}
|
||||
|
||||
public void testDuplicateDiscovery() {
|
||||
DummyDiscoveryPlugin plugin1 = () -> Collections.singletonMap("dup", () -> null);
|
||||
DummyDiscoveryPlugin plugin2 = () -> Collections.singletonMap("dup", () -> null);
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
|
||||
newModule(Settings.EMPTY, Arrays.asList(plugin1, plugin2)));
|
||||
assertEquals("Cannot register discovery type [dup] twice", e.getMessage());
|
||||
}
|
||||
|
||||
public void testHostsProvider() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "custom").build();
|
||||
AtomicBoolean created = new AtomicBoolean(false);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package org.elasticsearch.discovery;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import org.elasticsearch.action.ActionFuture;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
|
@ -38,17 +36,18 @@ import org.elasticsearch.snapshots.SnapshotInfo;
|
|||
import org.elasticsearch.snapshots.SnapshotMissingException;
|
||||
import org.elasticsearch.snapshots.SnapshotState;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
|
||||
|
@ -68,7 +67,6 @@ public class SnapshotDisruptionIT extends ESIntegTestCase {
|
|||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(AbstractDisruptionTestCase.DEFAULT_SETTINGS)
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ import org.elasticsearch.search.MockSearchService;
|
|||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
import org.elasticsearch.test.client.RandomizingClient;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption;
|
||||
import org.elasticsearch.test.disruption.ServiceDisruptionScheme;
|
||||
import org.elasticsearch.test.store.MockFSIndexStore;
|
||||
|
@ -1931,9 +1930,6 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
|||
initialNodeSettings.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType());
|
||||
initialTransportClientSettings.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType());
|
||||
}
|
||||
if (addTestZenDiscovery() && getUseZen2() == false) {
|
||||
initialNodeSettings.put(TestZenDiscovery.USE_ZEN2.getKey(), false);
|
||||
}
|
||||
return new NodeConfigurationSource() {
|
||||
@Override
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
|
@ -1979,14 +1975,6 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iff this returns true test zen discovery implementations is used for the test runs.
|
||||
* The default is {@code true}.
|
||||
*/
|
||||
protected boolean addTestZenDiscovery() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Returns {@code true} iff this test cluster should use a dummy http transport */
|
||||
protected boolean addMockHttpTransport() {
|
||||
return true;
|
||||
|
@ -2028,9 +2016,6 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
|||
if (addMockTransportService()) {
|
||||
mocks.add(getTestTransportPlugin());
|
||||
}
|
||||
if (addTestZenDiscovery()) {
|
||||
mocks.add(TestZenDiscovery.TestPlugin.class);
|
||||
}
|
||||
if (addMockHttpTransport()) {
|
||||
mocks.add(MockHttpTransport.TestPlugin.class);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.elasticsearch.node.NodeValidationException;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -193,7 +192,6 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
|
|||
.put(EsExecutors.PROCESSORS_SETTING.getKey(), 1) // limit the number of threads created
|
||||
.put("transport.type", getTestTransportType())
|
||||
.put(Node.NODE_DATA_SETTING.getKey(), true)
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), getUseZen2())
|
||||
.put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), random().nextLong())
|
||||
// default the watermarks low values to prevent tests from failing on nodes without enough disk space
|
||||
.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), "1b")
|
||||
|
@ -212,10 +210,6 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
|
|||
plugins = new ArrayList<>(plugins);
|
||||
plugins.add(getTestTransportPlugin());
|
||||
}
|
||||
if (plugins.contains(TestZenDiscovery.TestPlugin.class) == false) {
|
||||
plugins = new ArrayList<>(plugins);
|
||||
plugins.add(TestZenDiscovery.TestPlugin.class);
|
||||
}
|
||||
if (addMockHttpTransport()) {
|
||||
plugins.add(MockHttpTransport.TestPlugin.class);
|
||||
}
|
||||
|
|
|
@ -1006,17 +1006,6 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
return geohashGenerator.ofStringLength(random(), minPrecision, maxPrecision);
|
||||
}
|
||||
|
||||
private static boolean useZen2;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUseZen2() {
|
||||
useZen2 = true;
|
||||
}
|
||||
|
||||
protected static boolean getUseZen2() {
|
||||
return useZen2;
|
||||
}
|
||||
|
||||
public static String getTestTransportType() {
|
||||
return MockNioTransportPlugin.MOCK_NIO_TRANSPORT_NAME;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ import org.elasticsearch.common.util.concurrent.EsExecutors;
|
|||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
import org.elasticsearch.discovery.DiscoveryModule;
|
||||
import org.elasticsearch.discovery.zen.ElectMasterService;
|
||||
import org.elasticsearch.discovery.zen.ZenDiscovery;
|
||||
import org.elasticsearch.env.Environment;
|
||||
|
@ -106,7 +105,6 @@ import org.elasticsearch.node.NodeValidationException;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.ServiceDisruptionScheme;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
import org.elasticsearch.transport.MockTransportClient;
|
||||
|
@ -151,6 +149,9 @@ import static org.apache.lucene.util.LuceneTestCase.rarely;
|
|||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueMillis;
|
||||
import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.ZEN_DISCOVERY_TYPE;
|
||||
import static org.elasticsearch.discovery.DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.FileBasedUnicastHostsProvider.UNICAST_HOSTS_FILE;
|
||||
|
@ -158,8 +159,6 @@ import static org.elasticsearch.test.ESTestCase.assertBusy;
|
|||
import static org.elasticsearch.test.ESTestCase.awaitBusy;
|
||||
import static org.elasticsearch.test.ESTestCase.getTestTransportType;
|
||||
import static org.elasticsearch.test.ESTestCase.randomFrom;
|
||||
import static org.elasticsearch.test.discovery.TestZenDiscovery.USE_ZEN2;
|
||||
import static org.elasticsearch.test.discovery.TestZenDiscovery.usingZen1;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
@ -401,6 +400,10 @@ public final class InternalTestCluster extends TestCluster {
|
|||
EsExecutors.daemonThreadFactory("test_" + clusterName), new ThreadContext(Settings.EMPTY));
|
||||
}
|
||||
|
||||
private static boolean usingZen1(Settings settings) {
|
||||
return ZEN_DISCOVERY_TYPE.equals(DISCOVERY_TYPE_SETTING.get(settings));
|
||||
}
|
||||
|
||||
public int getBootstrapMasterNodeIndex() {
|
||||
return bootstrapMasterNodeIndex;
|
||||
}
|
||||
|
@ -636,9 +639,9 @@ public final class InternalTestCluster extends TestCluster {
|
|||
.put("node.name", name)
|
||||
.put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), seed);
|
||||
|
||||
final String discoveryType = DiscoveryModule.DISCOVERY_TYPE_SETTING.get(updatedSettings.build());
|
||||
final String discoveryType = DISCOVERY_TYPE_SETTING.get(updatedSettings.build());
|
||||
final boolean usingSingleNodeDiscovery = discoveryType.equals("single-node");
|
||||
final boolean usingZen1 = TestZenDiscovery.usingZen1(updatedSettings.build());
|
||||
final boolean usingZen1 = usingZen1(updatedSettings.build());
|
||||
if (usingSingleNodeDiscovery == false) {
|
||||
if (autoManageMinMasterNodes) {
|
||||
assertThat("min master nodes may not be set when auto managed",
|
||||
|
@ -1009,8 +1012,8 @@ public final class InternalTestCluster extends TestCluster {
|
|||
if (DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.exists(finalSettings)) {
|
||||
// simulating an upgrade from Zen1 to Zen2, but there's no way to remove a setting when restarting a node, so
|
||||
// you have to set it to REMOVED_MINIMUM_MASTER_NODES (== Integer.MAX_VALUE) to indicate its removal:
|
||||
assertTrue(USE_ZEN2.exists(finalSettings));
|
||||
assertTrue(USE_ZEN2.get(finalSettings));
|
||||
assertTrue(DISCOVERY_TYPE_SETTING.exists(finalSettings));
|
||||
assertThat(DISCOVERY_TYPE_SETTING.get(finalSettings), equalTo(ZEN2_DISCOVERY_TYPE));
|
||||
assertThat(DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(finalSettings), equalTo(REMOVED_MINIMUM_MASTER_NODES));
|
||||
|
||||
final Builder builder = Settings.builder().put(finalSettings);
|
||||
|
@ -2057,7 +2060,8 @@ public final class InternalTestCluster extends TestCluster {
|
|||
final int prevMasterCount = getMasterNodesCount();
|
||||
int autoBootstrapMasterNodeIndex =
|
||||
prevMasterCount == 0 && autoManageMinMasterNodes && newMasterCount > 0 && Arrays.stream(extraSettings)
|
||||
.allMatch(s -> Node.NODE_MASTER_SETTING.get(s) == false || TestZenDiscovery.USE_ZEN2.get(s) == true)
|
||||
.allMatch(s -> Node.NODE_MASTER_SETTING.get(s) == false
|
||||
|| ZEN2_DISCOVERY_TYPE.equals(DISCOVERY_TYPE_SETTING.get(s)))
|
||||
? RandomNumbers.randomIntBetween(random, 0, newMasterCount - 1) : -1;
|
||||
|
||||
final int numOfNodes = extraSettings.length;
|
||||
|
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.discovery;
|
||||
|
||||
import org.elasticsearch.cluster.coordination.Coordinator;
|
||||
import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
||||
import org.elasticsearch.cluster.service.ClusterApplier;
|
||||
import org.elasticsearch.cluster.service.ClusterApplierService;
|
||||
import org.elasticsearch.cluster.service.MasterService;
|
||||
import org.elasticsearch.common.Randomness;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.Discovery;
|
||||
import org.elasticsearch.discovery.DiscoveryModule;
|
||||
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
|
||||
import org.elasticsearch.discovery.zen.ZenDiscovery;
|
||||
import org.elasticsearch.discovery.zen.ZenPing;
|
||||
import org.elasticsearch.gateway.GatewayMetaState;
|
||||
import org.elasticsearch.plugins.DiscoveryPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
|
||||
/**
|
||||
* A alternative zen discovery which allows using mocks for things like pings, as well as
|
||||
* giving access to internals.
|
||||
*/
|
||||
public class TestZenDiscovery extends ZenDiscovery {
|
||||
|
||||
public static final Setting<Boolean> USE_MOCK_PINGS =
|
||||
Setting.boolSetting("discovery.zen.use_mock_pings", true, Setting.Property.NodeScope);
|
||||
|
||||
public static final Setting<Boolean> USE_ZEN2 =
|
||||
Setting.boolSetting("discovery.zen.use_zen2", true, Setting.Property.NodeScope);
|
||||
private static final String TEST_ZEN_DISCOVERY_TYPE = "test-zen";
|
||||
|
||||
/** A plugin which installs mock discovery and configures it to be used. */
|
||||
public static class TestPlugin extends Plugin implements DiscoveryPlugin {
|
||||
protected final Settings settings;
|
||||
public TestPlugin(Settings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService,
|
||||
NamedWriteableRegistry namedWriteableRegistry,
|
||||
MasterService masterService, ClusterApplier clusterApplier,
|
||||
ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider,
|
||||
AllocationService allocationService, GatewayMetaState gatewayMetaState) {
|
||||
// we don't get the latest setting which were updated by the extra settings for the plugin. TODO: fix.
|
||||
Settings fixedSettings = Settings.builder().put(settings).putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()).build();
|
||||
return Collections.singletonMap("test-zen", () -> {
|
||||
if (USE_ZEN2.get(settings)) {
|
||||
return new Coordinator("test_node", fixedSettings, clusterSettings, transportService, namedWriteableRegistry,
|
||||
allocationService, masterService,
|
||||
() -> gatewayMetaState.getPersistedState(settings, (ClusterApplierService) clusterApplier), hostsProvider,
|
||||
clusterApplier, Collections.emptyList(), new Random(Randomness.get().nextLong()));
|
||||
} else {
|
||||
return new TestZenDiscovery(fixedSettings, threadPool, transportService, namedWriteableRegistry, masterService,
|
||||
clusterApplier, clusterSettings, hostsProvider, allocationService, gatewayMetaState);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Setting<?>> getSettings() {
|
||||
return Arrays.asList(USE_MOCK_PINGS, USE_ZEN2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Settings additionalSettings() {
|
||||
return Settings.builder()
|
||||
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), TEST_ZEN_DISCOVERY_TYPE)
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
private TestZenDiscovery(Settings settings, ThreadPool threadPool, TransportService transportService,
|
||||
NamedWriteableRegistry namedWriteableRegistry, MasterService masterService,
|
||||
ClusterApplier clusterApplier, ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider,
|
||||
AllocationService allocationService, GatewayMetaState gatewayMetaState) {
|
||||
super(settings, threadPool, transportService, namedWriteableRegistry, masterService, clusterApplier, clusterSettings,
|
||||
hostsProvider, allocationService, Collections.emptyList(), gatewayMetaState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ZenPing newZenPing(Settings settings, ThreadPool threadPool, TransportService transportService,
|
||||
UnicastHostsProvider hostsProvider) {
|
||||
if (USE_MOCK_PINGS.get(settings) && USE_ZEN2.get(settings) == false) {
|
||||
return new MockZenPing(this);
|
||||
} else {
|
||||
return super.newZenPing(settings, threadPool, transportService, hostsProvider);
|
||||
}
|
||||
}
|
||||
|
||||
public ZenPing getZenPing() {
|
||||
return zenPing;
|
||||
}
|
||||
|
||||
public static boolean usingZen1(Settings settings) {
|
||||
return DiscoveryModule.ZEN_DISCOVERY_TYPE.equals(DiscoveryModule.DISCOVERY_TYPE_SETTING.get(settings))
|
||||
|| USE_ZEN2.get(settings) == false;
|
||||
}
|
||||
}
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.test.ESTestCase;
|
|||
import org.elasticsearch.test.InternalTestCluster;
|
||||
import org.elasticsearch.test.MockHttpTransport;
|
||||
import org.elasticsearch.test.NodeConfigurationSource;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.transport.TransportSettings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -72,7 +71,7 @@ import static org.hamcrest.Matchers.not;
|
|||
public class InternalTestClusterTests extends ESTestCase {
|
||||
|
||||
private static Collection<Class<? extends Plugin>> mockPlugins() {
|
||||
return Arrays.asList(getTestTransportPlugin(), TestZenDiscovery.TestPlugin.class, MockHttpTransport.TestPlugin.class);
|
||||
return Arrays.asList(getTestTransportPlugin(), MockHttpTransport.TestPlugin.class);
|
||||
}
|
||||
|
||||
public void testInitializiationIsConsistent() {
|
||||
|
|
|
@ -64,7 +64,6 @@ import org.elasticsearch.test.InternalTestCluster;
|
|||
import org.elasticsearch.test.MockHttpTransport;
|
||||
import org.elasticsearch.test.NodeConfigurationSource;
|
||||
import org.elasticsearch.test.TestCluster;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.transport.nio.MockNioTransportPlugin;
|
||||
|
@ -121,7 +120,7 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
|||
|
||||
stopClusters();
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(ESIntegTestCase.TestSeedPlugin.class,
|
||||
TestZenDiscovery.TestPlugin.class, MockHttpTransport.TestPlugin.class, MockTransportService.TestPlugin.class,
|
||||
MockHttpTransport.TestPlugin.class, MockTransportService.TestPlugin.class,
|
||||
MockNioTransportPlugin.class);
|
||||
|
||||
InternalTestCluster leaderCluster = new InternalTestCluster(randomLong(), createTempDir(), true, true, numberOfNodesPerCluster(),
|
||||
|
|
|
@ -8,12 +8,10 @@ package org.elasticsearch.xpack.ml.integration;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.disruption.NetworkDisruption;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
|
||||
|
@ -33,13 +31,6 @@ import java.util.Set;
|
|||
|
||||
public class NetworkDisruptionIT extends BaseMlIntegTestCase {
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> nodePlugins() {
|
||||
Collection<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins());
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.license.LicenseService;
|
|||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.MockHttpTransport;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.xpack.core.XPackSettings;
|
||||
import org.elasticsearch.xpack.core.ml.MachineLearningField;
|
||||
import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
|
||||
|
@ -114,7 +113,7 @@ public abstract class BaseMlIntegTestCase extends ESIntegTestCase {
|
|||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> getMockPlugins() {
|
||||
return Arrays.asList(TestZenDiscovery.TestPlugin.class, TestSeedPlugin.class, MockHttpTransport.TestPlugin.class);
|
||||
return Arrays.asList(TestSeedPlugin.class, MockHttpTransport.TestPlugin.class);
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.SecureString;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.discovery.DiscoveryModule;
|
||||
import org.elasticsearch.discovery.zen.ElectMasterService;
|
||||
import org.elasticsearch.node.MockNode;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
@ -35,7 +34,6 @@ import org.elasticsearch.test.MockHttpTransport;
|
|||
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||
import org.elasticsearch.test.SecuritySettingsSource;
|
||||
import org.elasticsearch.test.SecuritySettingsSourceField;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.transport.Netty4Plugin;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
|
@ -132,13 +130,6 @@ public class LicensingTests extends SecurityIntegTestCase {
|
|||
return super.maxNumberOfNodes() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void resetLicensing() {
|
||||
enableLicensing();
|
||||
|
@ -297,18 +288,10 @@ public class LicensingTests extends SecurityIntegTestCase {
|
|||
.put("network.host", "localhost")
|
||||
.put("cluster.name", internalCluster().getClusterName())
|
||||
.put("path.home", home)
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false)
|
||||
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "test-zen")
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), getUseZen2())
|
||||
.putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey())
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(), unicastHostsList);
|
||||
if (getUseZen2() == false) {
|
||||
nodeSettings.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(),
|
||||
ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(internalCluster().getInstance(Settings.class)));
|
||||
}
|
||||
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(LocalStateSecurity.class, TestZenDiscovery.TestPlugin.class,
|
||||
MockHttpTransport.TestPlugin.class);
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(LocalStateSecurity.class, MockHttpTransport.TestPlugin.class);
|
||||
try (Node node = new MockNode(nodeSettings.build(), mockPlugins)) {
|
||||
node.start();
|
||||
ensureStableCluster(cluster().size() + 1);
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.discovery.zen.ElectMasterService;
|
||||
import org.elasticsearch.node.MockNode;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.NodeValidationException;
|
||||
|
@ -22,7 +21,6 @@ import org.elasticsearch.test.MockHttpTransport;
|
|||
import org.elasticsearch.test.SecurityIntegTestCase;
|
||||
import org.elasticsearch.test.SecuritySettingsSource;
|
||||
import org.elasticsearch.test.SecuritySettingsSourceField;
|
||||
import org.elasticsearch.test.discovery.TestZenDiscovery;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.ConnectionProfile;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
|
@ -77,8 +75,7 @@ public class ServerTransportFilterIntegrationTests extends SecurityIntegTestCase
|
|||
// make sure this is "localhost", no matter if ipv4 or ipv6, but be consistent
|
||||
.put("transport.profiles.client.bind_host", "localhost")
|
||||
.put("xpack.security.audit.enabled", false)
|
||||
.put(XPackSettings.WATCHER_ENABLED.getKey(), false)
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false);
|
||||
.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
|
||||
if (randomBoolean()) {
|
||||
settingsBuilder.put("transport.profiles.default.xpack.security.type", "node"); // this is default lets set it randomly
|
||||
}
|
||||
|
@ -108,15 +105,8 @@ public class ServerTransportFilterIntegrationTests extends SecurityIntegTestCase
|
|||
.put("xpack.security.transport.ssl.enabled", true)
|
||||
.put(XPackSettings.WATCHER_ENABLED.getKey(), false)
|
||||
.put("path.home", home)
|
||||
.put(Node.NODE_MASTER_SETTING.getKey(), false)
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), getUseZen2())
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false);
|
||||
if (getUseZen2() == false) {
|
||||
nodeSettings.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(),
|
||||
ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(internalCluster().getInstance(Settings.class)));
|
||||
}
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(
|
||||
LocalStateSecurity.class, TestZenDiscovery.TestPlugin.class, MockHttpTransport.TestPlugin.class);
|
||||
.put(Node.NODE_MASTER_SETTING.getKey(), false);
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(LocalStateSecurity.class, MockHttpTransport.TestPlugin.class);
|
||||
addSSLSettingsForPEMFiles(
|
||||
nodeSettings,
|
||||
"/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem",
|
||||
|
@ -154,15 +144,8 @@ public class ServerTransportFilterIntegrationTests extends SecurityIntegTestCase
|
|||
.put(XPackSettings.WATCHER_ENABLED.getKey(), false)
|
||||
.put("discovery.initial_state_timeout", "0s")
|
||||
.put("path.home", home)
|
||||
.put(Node.NODE_MASTER_SETTING.getKey(), false)
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), getUseZen2())
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false);
|
||||
if (getUseZen2() == false) {
|
||||
nodeSettings.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(),
|
||||
ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(internalCluster().getInstance(Settings.class)));
|
||||
}
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(
|
||||
LocalStateSecurity.class, TestZenDiscovery.TestPlugin.class, MockHttpTransport.TestPlugin.class);
|
||||
.put(Node.NODE_MASTER_SETTING.getKey(), false);
|
||||
Collection<Class<? extends Plugin>> mockPlugins = Arrays.asList(LocalStateSecurity.class, MockHttpTransport.TestPlugin.class);
|
||||
addSSLSettingsForPEMFiles(
|
||||
nodeSettings,
|
||||
"/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem",
|
||||
|
|
Loading…
Reference in New Issue