From bdfb59aa00612754286defd069e37b0bba68c948 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Fri, 14 Mar 2014 10:51:03 +0700 Subject: [PATCH] [TESTS] Specify unicast hosts and transport port range specifically --- .../elasticsearch/discovery/DiscoveryTests.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/elasticsearch/discovery/DiscoveryTests.java b/src/test/java/org/elasticsearch/discovery/DiscoveryTests.java index 6a3fc2672dd..e0c8cd772e1 100644 --- a/src/test/java/org/elasticsearch/discovery/DiscoveryTests.java +++ b/src/test/java/org/elasticsearch/discovery/DiscoveryTests.java @@ -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));