[TESTS] Specify unicast hosts and transport port range specifically
This commit is contained in:
parent
e029258fcf
commit
bdfb59aa00
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.discovery;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -35,16 +34,18 @@ public class DiscoveryTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return ImmutableSettings.settingsBuilder().put("discovery.zen.ping.multicast.enabled", false)
|
||||
.put("discovery.zen.ping.unicast.hosts", "localhost").put(super.nodeSettings(nodeOrdinal)).build();
|
||||
return ImmutableSettings.settingsBuilder()
|
||||
.put("discovery.zen.ping.multicast.enabled", false)
|
||||
// Can't use this, b/c at the moment all node will only ping localhost:9300 and the shared
|
||||
// cluster will be running there, which leads of no node joining, because the cluster name
|
||||
// isn't equal.
|
||||
// .put("discovery.zen.ping.unicast.hosts", "localhost")
|
||||
.put("discovery.zen.ping.unicast.hosts", "localhost:25300,localhost:25301")
|
||||
.put("transport.tcp.port", "25300-25400")
|
||||
.put(super.nodeSettings(nodeOrdinal)).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
@LuceneTestCase.AwaitsFix(bugUrl = "Proposed fix: Each node maintains a list of endpoints that have pinged it " +
|
||||
"(UnicastZenPing#temporalResponses), a node will remove entries that are old. We can use this list to extend " +
|
||||
"'discovery.zen.ping.unicast.hosts' list of nodes to ping. If we do this then in the test both nodes will ping each " +
|
||||
"other, like in solution 1. The upside compared to solution 1, is that it won't go and ping 100 endpoints (based on the default port range), " +
|
||||
"just other nodes that have pinged it in addition to the already configured nodes in the 'discovery.zen.ping.unicast.hosts' list.")
|
||||
public void testUnicastDiscovery() {
|
||||
ClusterState state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.nodes().size(), equalTo(2));
|
||||
|
|
Loading…
Reference in New Issue