Test: MinimumMasterNodesTests.testCanNotBringClusterDown should always set minimum master nodes.

This commit is contained in:
Boaz Leskes 2014-11-10 09:29:20 +01:00
parent 696beb6e13
commit a1d5bcaa35
1 changed files with 4 additions and 5 deletions

View File

@ -322,13 +322,12 @@ public class MinimumMasterNodesTests extends ElasticsearchIntegrationTest {
.put("discovery.initial_state_timeout", "500ms")
.put("gateway.type", "local");
if (randomBoolean()) {
// sometime set an initial value
settings.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, randomIntBetween(1, nodeCount));
}
// set an initial value which is at least quorum to avoid split brains during initial startup
int initialMinMasterNodes = randomIntBetween(nodeCount / 2 + 1, nodeCount);
settings.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, initialMinMasterNodes);
logger.info("--> starting [{}] nodes", nodeCount);
logger.info("--> starting [{}] nodes. min_master_nodes set to [{}]", nodeCount, initialMinMasterNodes);
internalCluster().startNodesAsync(nodeCount, settings.build()).get();
logger.info("--> waiting for nodes to join");