move master node tests to cluster package, and force it to use zen disco always

This commit is contained in:
kimchy 2011-02-02 11:15:12 +02:00
parent d2a3f5142f
commit c86551d9b5
5 changed files with 52 additions and 10 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.test.integration;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
@ -40,6 +41,16 @@ public abstract class AbstractNodesTests {
private Map<String, Client> clients = newHashMap(); private Map<String, Client> clients = newHashMap();
private Settings defaultSettings = ImmutableSettings.Builder.EMPTY_SETTINGS;
public void putDefaultSettings(Settings.Builder settings) {
putDefaultSettings(settings.build());
}
public void putDefaultSettings(Settings settings) {
defaultSettings = ImmutableSettings.settingsBuilder().put(defaultSettings).put(settings).build();
}
public Node startNode(String id) { public Node startNode(String id) {
return buildNode(id).start(); return buildNode(id).start();
} }
@ -64,6 +75,7 @@ public abstract class AbstractNodesTests {
String settingsSource = getClass().getName().replace('.', '/') + ".yml"; String settingsSource = getClass().getName().replace('.', '/') + ".yml";
Settings finalSettings = settingsBuilder() Settings finalSettings = settingsBuilder()
.loadFromClasspath(settingsSource) .loadFromClasspath(settingsSource)
.put(defaultSettings)
.put(settings) .put(settings)
.put("name", id) .put("name", id)
.build(); .build();

View File

@ -0,0 +1,37 @@
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test.integration.cluster;
import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.BeforeClass;
import static org.elasticsearch.common.settings.ImmutableSettings.*;
/**
*
*/
public class AbstractZenNodesTests extends AbstractNodesTests {
@BeforeClass public void setUpZenDiscoSettings() {
// we force zen discovery here since it has specific handling for specific master / data nodes
// and disconnections
putDefaultSettings(settingsBuilder().put("discovery.type", "zen"));
}
}

View File

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.test.integration.datanode; package org.elasticsearch.test.integration.cluster;
import org.elasticsearch.action.UnavailableShardsException; import org.elasticsearch.action.UnavailableShardsException;
import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.index.IndexResponse;

View File

@ -17,10 +17,9 @@
* under the License. * under the License.
*/ */
package org.elasticsearch.test.integration.masternode; package org.elasticsearch.test.integration.cluster;
import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.discovery.MasterNotDiscoveredException;
import org.elasticsearch.test.integration.AbstractNodesTests;
import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -31,7 +30,7 @@ import static org.hamcrest.Matchers.*;
/** /**
* @author kimchy (shay.banon) * @author kimchy (shay.banon)
*/ */
public class SpecificMasterNodesTests extends AbstractNodesTests { public class SpecificMasterNodesTests extends AbstractZenNodesTests {
@AfterMethod public void closeNodes() { @AfterMethod public void closeNodes() {
closeAllNodes(); closeAllNodes();

View File

@ -1,6 +0,0 @@
cluster:
routing:
schedule: 100ms
index:
number_of_shards: 5
number_of_replicas: 1