diff --git a/server/src/test/java/org/elasticsearch/gateway/QuorumGatewayIT.java b/server/src/test/java/org/elasticsearch/gateway/QuorumGatewayIT.java index 6483c040a713a..fba9a005c539d 100644 --- a/server/src/test/java/org/elasticsearch/gateway/QuorumGatewayIT.java +++ b/server/src/test/java/org/elasticsearch/gateway/QuorumGatewayIT.java @@ -22,7 +22,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.health.ClusterHealthStatus; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -66,11 +65,6 @@ public void testQuorumRecovery() throws Exception { } logger.info("--> restart all nodes"); internalCluster().fullRestart(new RestartCallback() { - @Override - public Settings onNodeStopped(String nodeName) throws Exception { - return null; - } - @Override public void doAfterNodes(int numNodes, final Client activeClient) throws Exception { if (numNodes == 1) { diff --git a/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 554231982dac1..d429145e32948 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -661,8 +661,7 @@ public void testRestoreIndexWithShardsMissingInLocalGateway() throws Exception { .put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE) .build(); - internalCluster().startNode(nodeSettings); - internalCluster().startNode(nodeSettings); + internalCluster().startNodes(2, nodeSettings); cluster().wipeIndices("_all"); logger.info("--> create repository"); diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java index 70d3c95eb7f7d..012c574f9e6aa 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java @@ -929,13 +929,15 @@ Settings closeForRestart(RestartCallback callback, int minMasterNodes) throws Ex assert callback != null; close(); Settings callbackSettings = callback.onNodeStopped(name); + assert callbackSettings != null; Settings.Builder newSettings = Settings.builder(); - if (callbackSettings != null) { - newSettings.put(callbackSettings); - } + newSettings.put(callbackSettings); if (minMasterNodes >= 0) { assert DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.exists(newSettings.build()) == false : "min master nodes is auto managed"; - newSettings.put(DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), minMasterNodes).build(); + newSettings.put(DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), minMasterNodes); + if (INITIAL_MASTER_NODES_SETTING.exists(callbackSettings) == false) { + newSettings.putList(INITIAL_MASTER_NODES_SETTING.getKey()); + } } // delete data folders now, before we start other nodes that may claim it clearDataIfNeeded(callback); @@ -1691,12 +1693,7 @@ public synchronized void restartNode(String nodeName, RestartCallback callback) } } - public static final RestartCallback EMPTY_CALLBACK = new RestartCallback() { - @Override - public Settings onNodeStopped(String node) { - return null; - } - }; + public static final RestartCallback EMPTY_CALLBACK = new RestartCallback(); /** * Restarts all nodes in the cluster. It first stops all nodes and then restarts all the nodes again.