[TEST] replaced cluster().size() calls with immutableCluster().size

This commit is contained in:
javanna 2014-03-31 19:07:30 +02:00 committed by Luca Cavanna
parent 8fe6fe638d
commit bae3203e3b
7 changed files with 10 additions and 10 deletions

View File

@ -88,7 +88,7 @@ public class HotThreadsTest extends ElasticsearchIntegrationTest {
try { try {
assertThat(nodeHotThreads, notNullValue()); assertThat(nodeHotThreads, notNullValue());
Map<String,NodeHotThreads> nodesMap = nodeHotThreads.getNodesMap(); Map<String,NodeHotThreads> nodesMap = nodeHotThreads.getNodesMap();
assertThat(nodesMap.size(), equalTo(cluster().size())); assertThat(nodesMap.size(), equalTo(immutableCluster().size()));
for (NodeHotThreads ht : nodeHotThreads) { for (NodeHotThreads ht : nodeHotThreads) {
assertNotNull(ht.getHotThreads()); assertNotNull(ht.getHotThreads());
//logger.info(ht.getHotThreads()); //logger.info(ht.getHotThreads());

View File

@ -61,7 +61,7 @@ public class SimpleClusterStateTests extends ElasticsearchIntegrationTest {
@Test @Test
public void testNodes() throws Exception { public void testNodes() throws Exception {
ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().clear().setNodes(true).get(); ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().clear().setNodes(true).get();
assertThat(clusterStateResponse.getState().nodes().nodes().size(), is(cluster().size())); assertThat(clusterStateResponse.getState().nodes().nodes().size(), is(immutableCluster().size()));
ClusterStateResponse clusterStateResponseFiltered = client().admin().cluster().prepareState().clear().get(); ClusterStateResponse clusterStateResponseFiltered = client().admin().cluster().prepareState().clear().get();
assertThat(clusterStateResponseFiltered.getState().nodes().nodes().size(), is(0)); assertThat(clusterStateResponseFiltered.getState().nodes().nodes().size(), is(0));

View File

@ -58,7 +58,7 @@ public class AckClusterUpdateSettingsTests extends ElasticsearchIntegrationTest
@Override @Override
protected int minimumNumberOfShards() { protected int minimumNumberOfShards() {
return cluster().size(); return immutableCluster().size();
} }
@Override @Override

View File

@ -157,7 +157,7 @@ public class ClusterRerouteTests extends ElasticsearchIntegrationTest {
logger.info("--> starting 2 nodes"); logger.info("--> starting 2 nodes");
String node_1 = cluster().startNode(commonSettings); String node_1 = cluster().startNode(commonSettings);
cluster().startNode(commonSettings); cluster().startNode(commonSettings);
assertThat(cluster().size(), equalTo(2)); assertThat(immutableCluster().size(), equalTo(2));
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet(); ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false)); assertThat(healthResponse.isTimedOut(), equalTo(false));
@ -228,7 +228,7 @@ public class ClusterRerouteTests extends ElasticsearchIntegrationTest {
logger.info("--> starting a node"); logger.info("--> starting a node");
String node_1 = cluster().startNode(commonSettings); String node_1 = cluster().startNode(commonSettings);
assertThat(cluster().size(), equalTo(1)); assertThat(immutableCluster().size(), equalTo(1));
ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("1").execute().actionGet(); ClusterHealthResponse healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("1").execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false)); assertThat(healthResponse.isTimedOut(), equalTo(false));
@ -247,7 +247,7 @@ public class ClusterRerouteTests extends ElasticsearchIntegrationTest {
logger.info("--> starting a second node"); logger.info("--> starting a second node");
String node_2 = cluster().startNode(commonSettings); String node_2 = cluster().startNode(commonSettings);
assertThat(cluster().size(), equalTo(2)); assertThat(immutableCluster().size(), equalTo(2));
healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet(); healthResponse = client().admin().cluster().prepareHealth().setWaitForNodes("2").execute().actionGet();
assertThat(healthResponse.isTimedOut(), equalTo(false)); assertThat(healthResponse.isTimedOut(), equalTo(false));

View File

@ -45,7 +45,7 @@ public class FilteringAllocationTests extends ElasticsearchIntegrationTest {
logger.info("--> starting 2 nodes"); logger.info("--> starting 2 nodes");
final String node_0 = cluster().startNode(); final String node_0 = cluster().startNode();
final String node_1 = cluster().startNode(); final String node_1 = cluster().startNode();
assertThat(cluster().size(), equalTo(2)); assertThat(immutableCluster().size(), equalTo(2));
logger.info("--> creating an index with no replicas"); logger.info("--> creating an index with no replicas");
client().admin().indices().prepareCreate("test") client().admin().indices().prepareCreate("test")
@ -84,7 +84,7 @@ public class FilteringAllocationTests extends ElasticsearchIntegrationTest {
logger.info("--> starting 2 nodes"); logger.info("--> starting 2 nodes");
final String node_0 = cluster().startNode(); final String node_0 = cluster().startNode();
final String node_1 = cluster().startNode(); final String node_1 = cluster().startNode();
assertThat(cluster().size(), equalTo(2)); assertThat(immutableCluster().size(), equalTo(2));
logger.info("--> creating an index with no replicas"); logger.info("--> creating an index with no replicas");
client().admin().indices().prepareCreate("test") client().admin().indices().prepareCreate("test")

View File

@ -58,7 +58,7 @@ public class ShardsAllocatorModuleTests extends ElasticsearchIntegrationTest {
} }
private void assertAllocatorInstance(Settings settings, Class<? extends ShardsAllocator> clazz) { private void assertAllocatorInstance(Settings settings, Class<? extends ShardsAllocator> clazz) {
while (cluster().size() != 0) { while (immutableCluster().size() != 0) {
cluster().stopRandomNode(); cluster().stopRandomNode();
} }
cluster().startNode(settings); cluster().startNode(settings);

View File

@ -73,7 +73,7 @@ public class ConcurrentDocumentOperationTests extends ElasticsearchIntegrationTe
logger.info("done indexing, check all have the same field value"); logger.info("done indexing, check all have the same field value");
Map masterSource = client().prepareGet("test", "type1", "1").execute().actionGet().getSourceAsMap(); Map masterSource = client().prepareGet("test", "type1", "1").execute().actionGet().getSourceAsMap();
for (int i = 0; i < (cluster().size() * 5); i++) { for (int i = 0; i < (immutableCluster().size() * 5); i++) {
assertThat(client().prepareGet("test", "type1", "1").execute().actionGet().getSourceAsMap(), equalTo(masterSource)); assertThat(client().prepareGet("test", "type1", "1").execute().actionGet().getSourceAsMap(), equalTo(masterSource));
} }
} }