[TEST] moved dataNodes method to ImmutableTestCluster base class, replaced cluster().dataNodes() calls with immutableCluster().dataNodes()
This commit is contained in:
parent
bae3203e3b
commit
d570d588a8
|
@ -107,7 +107,7 @@ public class AckClusterUpdateSettingsTests extends ElasticsearchIntegrationTest
|
|||
public void testClusterUpdateSettingsNoAcknowledgement() {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.put("number_of_shards", between(cluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put("number_of_shards", between(immutableCluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put("number_of_replicas", 0)).get();
|
||||
ensureGreen();
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ public class AckTests extends ElasticsearchIntegrationTest {
|
|||
public void testClusterRerouteAcknowledgement() throws InterruptedException {
|
||||
assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder()
|
||||
.put(indexSettings())
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(immutableCluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)
|
||||
));
|
||||
ensureGreen();
|
||||
|
@ -215,7 +215,7 @@ public class AckTests extends ElasticsearchIntegrationTest {
|
|||
public void testClusterRerouteNoAcknowledgement() throws InterruptedException {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(immutableCluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
ensureGreen();
|
||||
|
||||
|
@ -229,7 +229,7 @@ public class AckTests extends ElasticsearchIntegrationTest {
|
|||
public void testClusterRerouteAcknowledgementDryRun() throws InterruptedException {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(immutableCluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
ensureGreen();
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class AckTests extends ElasticsearchIntegrationTest {
|
|||
public void testClusterRerouteNoAcknowledgementDryRun() throws InterruptedException {
|
||||
client().admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder()
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(cluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_SHARDS, between(immutableCluster().dataNodes(), DEFAULT_MAX_NUM_SHARDS))
|
||||
.put(SETTING_NUMBER_OF_REPLICAS, 0)).get();
|
||||
ensureGreen();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SuggestStatsTests extends ElasticsearchIntegrationTest {
|
|||
public void testSimpleStats() throws Exception {
|
||||
// clear all stats first
|
||||
client().admin().indices().prepareStats().clear().execute().actionGet();
|
||||
final int numNodes = cluster().dataNodes();
|
||||
final int numNodes = immutableCluster().dataNodes();
|
||||
assertThat(numNodes, greaterThanOrEqualTo(2));
|
||||
final int shardsIdx1 = randomIntBetween(1, 10); // we make sure each node gets at least a single shard...
|
||||
final int shardsIdx2 = Math.max(numNodes - shardsIdx1, randomIntBetween(1, 10));
|
||||
|
|
|
@ -38,7 +38,7 @@ public class SearchPreferenceTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test // see #2896
|
||||
public void testStopOneNodePreferenceWithRedState() throws InterruptedException {
|
||||
assertAcked(prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", cluster().dataNodes()+2).put("index.number_of_replicas", 0)));
|
||||
assertAcked(prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", immutableCluster().dataNodes()+2).put("index.number_of_replicas", 0)));
|
||||
ensureGreen();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
client().prepareIndex("test", "type1", ""+i).setSource("field1", "value1").execute().actionGet();
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SearchStatsTests extends ElasticsearchIntegrationTest {
|
|||
public void testSimpleStats() throws Exception {
|
||||
// clear all stats first
|
||||
client().admin().indices().prepareStats().clear().execute().actionGet();
|
||||
final int numNodes = cluster().dataNodes();
|
||||
final int numNodes = immutableCluster().dataNodes();
|
||||
assertThat(numNodes, greaterThanOrEqualTo(2));
|
||||
final int shardsIdx1 = randomIntBetween(1, 10); // we make sure each node gets at least a single shard...
|
||||
final int shardsIdx2 = Math.max(numNodes - shardsIdx1, randomIntBetween(1, 10));
|
||||
|
|
|
@ -324,7 +324,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
}
|
||||
|
||||
protected int maximumNumberOfReplicas() {
|
||||
return cluster().dataNodes() - 1;
|
||||
return immutableCluster().dataNodes() - 1;
|
||||
}
|
||||
|
||||
protected int numberOfReplicas() {
|
||||
|
|
|
@ -118,6 +118,11 @@ public abstract class ImmutableTestCluster implements Iterable<Client> {
|
|||
*/
|
||||
public abstract int size();
|
||||
|
||||
/**
|
||||
* Returns the number of data nodes in the cluster.
|
||||
*/
|
||||
public abstract int dataNodes();
|
||||
|
||||
/**
|
||||
* Closes the current cluster
|
||||
*/
|
||||
|
|
|
@ -1035,6 +1035,7 @@ public final class TestCluster extends ImmutableTestCluster {
|
|||
reset(wipeData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int dataNodes() {
|
||||
return dataNodeAndClients().size();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue