Migrate IndicesExistsIT to Zen2 (#37526)
This test was actually passing, for the wrong reason: it asserts a `MasterNotDiscoveredException` is thrown, expecting this to be due to a failure to perform state recovery, but in fact it's thrown because the node is not correctly bootstrapped.
This commit is contained in:
parent
25aac4f77f
commit
699d881739
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.action.admin.indices.exists;
|
||||
|
||||
import org.elasticsearch.cluster.coordination.ClusterBootstrapService;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.MasterNotDiscoveredException;
|
||||
|
@ -29,17 +30,29 @@ import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
|||
import org.elasticsearch.test.InternalTestCluster;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.elasticsearch.node.Node.NODE_MASTER_SETTING;
|
||||
import static org.elasticsearch.node.Node.NODE_NAME_SETTING;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
|
||||
|
||||
@ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0, transportClientRatio = 0.0,
|
||||
autoMinMasterNodes = false)
|
||||
public class IndicesExistsIT extends ESIntegTestCase {
|
||||
|
||||
@Override
|
||||
protected List<Settings> addExtraClusterBootstrapSettings(List<Settings> allNodesSettings) {
|
||||
final List<String> masterNodeNames
|
||||
= allNodesSettings.stream().filter(NODE_MASTER_SETTING::get).map(NODE_NAME_SETTING::get).collect(Collectors.toList());
|
||||
return allNodesSettings.stream().map(s -> Settings.builder().put(s)
|
||||
.putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey(), masterNodeNames).build()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void testIndexExistsWithBlocksInPlace() throws IOException {
|
||||
Settings settings = Settings.builder()
|
||||
.put(GatewayService.RECOVER_AFTER_NODES_SETTING.getKey(), 99)
|
||||
.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), 1).build();
|
||||
.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), Integer.MAX_VALUE).build();
|
||||
String node = internalCluster().startNode(settings);
|
||||
|
||||
assertThrows(client(node).admin().indices().prepareExists("test").setMasterNodeTimeout(TimeValue.timeValueSeconds(0)),
|
||||
|
|
Loading…
Reference in New Issue