|
19 | 19 |
|
20 | 20 | package org.elasticsearch.discovery;
|
21 | 21 |
|
22 |
| -import java.nio.file.Path; |
23 | 22 | import org.elasticsearch.cluster.ClusterState;
|
24 | 23 | import org.elasticsearch.cluster.block.ClusterBlock;
|
25 | 24 | import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
26 | 25 | import org.elasticsearch.cluster.node.DiscoveryNodes;
|
27 | 26 | import org.elasticsearch.common.Nullable;
|
28 | 27 | import org.elasticsearch.common.settings.Settings;
|
29 | 28 | import org.elasticsearch.common.unit.TimeValue;
|
30 |
| -import org.elasticsearch.discovery.zen.ElectMasterService; |
31 | 29 | import org.elasticsearch.discovery.zen.FaultDetection;
|
32 | 30 | import org.elasticsearch.discovery.zen.UnicastZenPing;
|
33 | 31 | import org.elasticsearch.discovery.zen.ZenPing;
|
34 |
| -import org.elasticsearch.env.NodeEnvironment; |
35 | 32 | import org.elasticsearch.plugins.Plugin;
|
36 | 33 | import org.elasticsearch.test.ESIntegTestCase;
|
37 | 34 | import org.elasticsearch.test.InternalTestCluster;
|
38 |
| -import org.elasticsearch.test.NodeConfigurationSource; |
39 | 35 | import org.elasticsearch.test.discovery.TestZenDiscovery;
|
40 | 36 | import org.elasticsearch.test.disruption.NetworkDisruption;
|
41 | 37 | import org.elasticsearch.test.disruption.NetworkDisruption.Bridge;
|
|
56 | 52 | import java.util.Set;
|
57 | 53 | import java.util.concurrent.TimeUnit;
|
58 | 54 |
|
59 |
| -import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING; |
60 | 55 | import static org.hamcrest.Matchers.equalTo;
|
61 | 56 | import static org.hamcrest.Matchers.not;
|
62 | 57 |
|
63 | 58 | public abstract class AbstractDisruptionTestCase extends ESIntegTestCase {
|
64 | 59 |
|
65 | 60 | static final TimeValue DISRUPTION_HEALING_OVERHEAD = TimeValue.timeValueSeconds(40); // we use 30s as timeout in many places.
|
66 | 61 |
|
67 |
| - private NodeConfigurationSource discoveryConfig; |
68 | 62 |
|
69 | 63 | @Override
|
70 | 64 | protected Settings nodeSettings(int nodeOrdinal) {
|
71 |
| - return Settings.builder().put(discoveryConfig.nodeSettings(nodeOrdinal)) |
| 65 | + return Settings.builder().put(super.nodeSettings(nodeOrdinal)).put(DEFAULT_SETTINGS) |
72 | 66 | .put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false).build();
|
73 | 67 | }
|
74 | 68 |
|
75 |
| - @Before |
76 |
| - public void clearConfig() { |
77 |
| - discoveryConfig = null; |
78 |
| - } |
79 |
| - |
80 | 69 | @Override
|
81 | 70 | protected int numberOfShards() {
|
82 | 71 | return 3;
|
@@ -118,11 +107,6 @@ protected void beforeIndexDeletion() throws Exception {
|
118 | 107 | }
|
119 | 108 |
|
120 | 109 | List<String> startCluster(int numberOfNodes) {
|
121 |
| - return startCluster(numberOfNodes, -1); |
122 |
| - } |
123 |
| - |
124 |
| - List<String> startCluster(int numberOfNodes, int minimumMasterNode) { |
125 |
| - configureCluster(numberOfNodes, minimumMasterNode); |
126 | 110 | InternalTestCluster internalCluster = internalCluster();
|
127 | 111 | List<String> nodes = internalCluster.startNodes(numberOfNodes);
|
128 | 112 | ensureStableCluster(numberOfNodes);
|
@@ -151,38 +135,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
|
151 | 135 | return Arrays.asList(MockTransportService.TestPlugin.class);
|
152 | 136 | }
|
153 | 137 |
|
154 |
| - void configureCluster(int numberOfNodes, int minimumMasterNode) { |
155 |
| - configureCluster(DEFAULT_SETTINGS, numberOfNodes, minimumMasterNode); |
156 |
| - } |
157 |
| - |
158 |
| - void configureCluster(Settings settings, int numberOfNodes, int minimumMasterNode) { |
159 |
| - if (minimumMasterNode < 0) { |
160 |
| - minimumMasterNode = numberOfNodes / 2 + 1; |
161 |
| - } |
162 |
| - logger.info("---> configured unicast"); |
163 |
| - // TODO: Rarely use default settings form some of these |
164 |
| - Settings nodeSettings = Settings.builder() |
165 |
| - .put(settings) |
166 |
| - .put(NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(), numberOfNodes) |
167 |
| - .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), minimumMasterNode) |
168 |
| - .putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file") |
169 |
| - .build(); |
170 |
| - |
171 |
| - if (discoveryConfig == null) { |
172 |
| - discoveryConfig = new NodeConfigurationSource() { |
173 |
| - @Override |
174 |
| - public Settings nodeSettings(final int nodeOrdinal) { |
175 |
| - return nodeSettings; |
176 |
| - } |
177 |
| - |
178 |
| - @Override |
179 |
| - public Path nodeConfigPath(final int nodeOrdinal) { |
180 |
| - return null; |
181 |
| - } |
182 |
| - }; |
183 |
| - } |
184 |
| - } |
185 |
| - |
186 | 138 | ClusterState getNodeClusterState(String node) {
|
187 | 139 | return client(node).admin().cluster().prepareState().setLocal(true).get().getState();
|
188 | 140 | }
|
|
0 commit comments