From aa43c7a69eaf3740113411b0f28776e3ec2e095b Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 12 Mar 2014 12:58:37 +0100 Subject: [PATCH] [TEST] stabelize SearchStatsTests --- .../java/org/elasticsearch/search/stats/SearchStatsTests.java | 2 +- src/test/java/org/elasticsearch/test/TestCluster.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java b/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java index 63503067618..d6ee7d30417 100644 --- a/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java +++ b/src/test/java/org/elasticsearch/search/stats/SearchStatsTests.java @@ -71,12 +71,12 @@ public class SearchStatsTests extends ElasticsearchIntegrationTest { refresh(); } } - refresh(); cluster().ensureAtMostNumNodes(numAssignedShards("test1", "test2")); assertThat(cluster().size(), greaterThanOrEqualTo(2)); assertThat(numAssignedShards("test1", "test2"), greaterThanOrEqualTo(2)); // THERE WILL BE AT LEAST 2 NODES HERE SO WE CAN WAIT FOR GREEN ensureGreen(); + refresh(); int iters = atLeast(20); for (int i = 0; i < iters; i++) { SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.termQuery("field", "value")).setStats("group1", "group2").execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/test/TestCluster.java b/src/test/java/org/elasticsearch/test/TestCluster.java index 07b3c08ff9d..aab0ed41447 100644 --- a/src/test/java/org/elasticsearch/test/TestCluster.java +++ b/src/test/java/org/elasticsearch/test/TestCluster.java @@ -345,7 +345,7 @@ public final class TestCluster implements Iterable { // prevent killing the master if possible final Iterator values = n == 0 ? nodes.values().iterator() : Iterators.filter(nodes.values().iterator(), Predicates.not(new MasterNodePredicate(getMasterName()))); final Iterator limit = Iterators.limit(values, nodes.size() - n); - logger.info("reducing cluster size from {} to {}", nodes.size() - n, n); + logger.info("changing cluster size from {} to {}", nodes.size() - n, n); Set nodesToRemove = new HashSet(); while (limit.hasNext()) { NodeAndClient next = limit.next();