From bae3203e3beee284ca79ef9e004dd7abb1cb5b94 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 31 Mar 2014 19:07:30 +0200 Subject: [PATCH] [TEST] replaced cluster().size() calls with immutableCluster().size --- .../java/org/elasticsearch/action/admin/HotThreadsTest.java | 2 +- .../org/elasticsearch/cluster/SimpleClusterStateTests.java | 2 +- .../cluster/ack/AckClusterUpdateSettingsTests.java | 2 +- .../cluster/allocation/ClusterRerouteTests.java | 6 +++--- .../cluster/allocation/FilteringAllocationTests.java | 4 ++-- .../cluster/allocation/ShardsAllocatorModuleTests.java | 2 +- .../versioning/ConcurrentDocumentOperationTests.java | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/elasticsearch/action/admin/HotThreadsTest.java b/src/test/java/org/elasticsearch/action/admin/HotThreadsTest.java index 5712c28cef1..a32bd70c1c1 100644 --- a/src/test/java/org/elasticsearch/action/admin/HotThreadsTest.java +++ b/src/test/java/org/elasticsearch/action/admin/HotThreadsTest.java @@ -88,7 +88,7 @@ public class HotThreadsTest extends ElasticsearchIntegrationTest { try { assertThat(nodeHotThreads, notNullValue()); Map nodesMap = nodeHotThreads.getNodesMap(); - assertThat(nodesMap.size(), equalTo(cluster().size())); + assertThat(nodesMap.size(), equalTo(immutableCluster().size())); for (NodeHotThreads ht : nodeHotThreads) { assertNotNull(ht.getHotThreads()); //logger.info(ht.getHotThreads()); diff --git a/src/test/java/org/elasticsearch/cluster/SimpleClusterStateTests.java b/src/test/java/org/elasticsearch/cluster/SimpleClusterStateTests.java index 9a3f9ddcbe3..24e63587376 100644 --- a/src/test/java/org/elasticsearch/cluster/SimpleClusterStateTests.java +++ b/src/test/java/org/elasticsearch/cluster/SimpleClusterStateTests.java @@ -61,7 +61,7 @@ public class SimpleClusterStateTests extends ElasticsearchIntegrationTest { @Test public void testNodes() throws Exception { 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(); assertThat(clusterStateResponseFiltered.getState().nodes().nodes().size(), is(0)); diff --git a/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java b/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java index f546586446b..52ea073a84d 100644 --- a/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java +++ b/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsTests.java @@ -58,7 +58,7 @@ public class AckClusterUpdateSettingsTests extends ElasticsearchIntegrationTest @Override protected int minimumNumberOfShards() { - return cluster().size(); + return immutableCluster().size(); } @Override diff --git a/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java b/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java index 504288635b2..4186f00fb9d 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/ClusterRerouteTests.java @@ -157,7 +157,7 @@ public class ClusterRerouteTests extends ElasticsearchIntegrationTest { logger.info("--> starting 2 nodes"); String node_1 = 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(); assertThat(healthResponse.isTimedOut(), equalTo(false)); @@ -228,7 +228,7 @@ public class ClusterRerouteTests extends ElasticsearchIntegrationTest { logger.info("--> starting a node"); 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(); assertThat(healthResponse.isTimedOut(), equalTo(false)); @@ -247,7 +247,7 @@ public class ClusterRerouteTests extends ElasticsearchIntegrationTest { logger.info("--> starting a second node"); 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(); assertThat(healthResponse.isTimedOut(), equalTo(false)); diff --git a/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java b/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java index 448276cdb6f..5ce49baa1fe 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/FilteringAllocationTests.java @@ -45,7 +45,7 @@ public class FilteringAllocationTests extends ElasticsearchIntegrationTest { logger.info("--> starting 2 nodes"); final String node_0 = 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"); client().admin().indices().prepareCreate("test") @@ -84,7 +84,7 @@ public class FilteringAllocationTests extends ElasticsearchIntegrationTest { logger.info("--> starting 2 nodes"); final String node_0 = 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"); client().admin().indices().prepareCreate("test") diff --git a/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java b/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java index 7f537eae717..ba876f18755 100644 --- a/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java +++ b/src/test/java/org/elasticsearch/cluster/allocation/ShardsAllocatorModuleTests.java @@ -58,7 +58,7 @@ public class ShardsAllocatorModuleTests extends ElasticsearchIntegrationTest { } private void assertAllocatorInstance(Settings settings, Class clazz) { - while (cluster().size() != 0) { + while (immutableCluster().size() != 0) { cluster().stopRandomNode(); } cluster().startNode(settings); diff --git a/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java b/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java index a0395cf98b9..f7044d7a628 100644 --- a/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java +++ b/src/test/java/org/elasticsearch/versioning/ConcurrentDocumentOperationTests.java @@ -73,7 +73,7 @@ public class ConcurrentDocumentOperationTests extends ElasticsearchIntegrationTe logger.info("done indexing, check all have the same field value"); 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)); } }