|
@@ -33,17 +33,25 @@ import org.elasticsearch.test.ESIntegTestCase.Scope;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static org.elasticsearch.discovery.zen.ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING;
|
|
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
import static org.hamcrest.Matchers.notNullValue;
|
|
|
import static org.hamcrest.Matchers.nullValue;
|
|
|
|
|
|
-@ClusterScope(scope = Scope.TEST, numDataNodes = 0)
|
|
|
+@ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoMinMasterNodes = false)
|
|
|
public class SpecificMasterNodesIT extends ESIntegTestCase {
|
|
|
|
|
|
+ @Override
|
|
|
+ protected Settings nodeSettings(int nodeOrdinal) {
|
|
|
+ return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
|
|
+ .put(DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 1).build();
|
|
|
+ }
|
|
|
+
|
|
|
public void testSimpleOnlyMasterNodeElection() throws IOException {
|
|
|
logger.info("--> start data node / non master node");
|
|
|
- internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false).put("discovery.initial_state_timeout", "1s"));
|
|
|
+ internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false)
|
|
|
+ .put("discovery.initial_state_timeout", "1s"));
|
|
|
try {
|
|
|
assertThat(client().admin().cluster().prepareState().setMasterNodeTimeout("100ms").execute().actionGet().getState().nodes().getMasterNodeId(), nullValue());
|
|
|
fail("should not be able to find master");
|