Test: move no master node test over to only use unicast zen discovery. On the build server there is no multicast enabled.

Original commit: elastic/x-pack-elasticsearch@20eab58db1
This commit is contained in:
Martijn van Groningen 2014-11-09 23:17:20 +00:00
parent e87b0a980c
commit 3c1e31bfbf
1 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import org.elasticsearch.discovery.DiscoverySettings;
import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.discovery.MasterNotDiscoveredException;
import org.elasticsearch.discovery.zen.elect.ElectMasterService; import org.elasticsearch.discovery.zen.elect.ElectMasterService;
import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.discovery.ClusterDiscoveryConfiguration;
import org.junit.Test; import org.junit.Test;
import static org.elasticsearch.index.query.QueryBuilders.termQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery;
@ -32,11 +33,15 @@ import static org.hamcrest.core.Is.is;
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0, numDataNodes = 0) @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numClientNodes = 0, transportClientRatio = 0, numDataNodes = 0)
public class NoMasterNodeTests extends AbstractAlertingTests { public class NoMasterNodeTests extends AbstractAlertingTests {
private ClusterDiscoveryConfiguration.UnicastZen config;
@Override @Override
protected Settings nodeSettings(int nodeOrdinal) { protected Settings nodeSettings(int nodeOrdinal) {
Settings settings = super.nodeSettings(nodeOrdinal); Settings settings = super.nodeSettings(nodeOrdinal);
Settings unicastSettings = config.node(nodeOrdinal);
return ImmutableSettings.builder() return ImmutableSettings.builder()
.put(settings) .put(settings)
.put(unicastSettings)
.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 2) .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 2)
.put("discovery.type", "zen") .put("discovery.type", "zen")
.build(); .build();
@ -44,6 +49,7 @@ public class NoMasterNodeTests extends AbstractAlertingTests {
@Test @Test
public void testSimpleFailure() throws Exception { public void testSimpleFailure() throws Exception {
config = new ClusterDiscoveryConfiguration.UnicastZen(2);
internalTestCluster().startNodesAsync(2).get(); internalTestCluster().startNodesAsync(2).get();
AlertsClientInterface alertsClient = alertClient(); AlertsClientInterface alertsClient = alertClient();
createIndex("my-index"); createIndex("my-index");