allow joining nodes, conflicting with existing nodes to elect a master (elastic/elasticsearch#2996)

this is a companion PR to elastic/elasticsearchelastic/elasticsearch#19743

Original commit: elastic/x-pack-elasticsearch@193c92d99a
This commit is contained in:
Boaz Leskes 2016-08-05 09:07:29 +02:00 committed by GitHub
parent e52be3a956
commit a2cca18c49
2 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ public class LicenseClusterChangeTests extends AbstractLicenseServiceTestCase {
public void testTrialLicenseGeneration() throws Exception {
DiscoveryNode master = new DiscoveryNode("b", LocalTransportAddress.buildUnique(), emptyMap(), emptySet(), Version.CURRENT);
ClusterState oldState = ClusterState.builder(new ClusterName("a"))
.nodes(DiscoveryNodes.builder().masterNodeId(master.getId()).put(master)).build();
.nodes(DiscoveryNodes.builder().masterNodeId(master.getId()).add(master)).build();
when(discoveryNodes.isLocalNodeElectedMaster()).thenReturn(true);
ClusterState newState = ClusterState.builder(oldState).nodes(discoveryNodes).build();

View File

@ -37,7 +37,7 @@ public class ClusterStateResolverTests extends MonitoringIndexNameResolverTestCa
DiscoveryNode masterNode = new DiscoveryNode("master", new LocalTransportAddress("master"),
emptyMap(), emptySet(), Version.CURRENT);
DiscoveryNode otherNode = new DiscoveryNode("other", new LocalTransportAddress("other"), emptyMap(), emptySet(), Version.CURRENT);
DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().put(masterNode).put(otherNode).masterNodeId(masterNode.getId()).build();
DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().add(masterNode).add(otherNode).masterNodeId(masterNode.getId()).build();
ClusterState clusterState = ClusterState.builder(new ClusterName("test")).nodes(discoveryNodes).build();
doc.setClusterState(clusterState);
return doc;