[TEST] stabelize SearchStatsTests

This commit is contained in:
Simon Willnauer 2014-03-12 12:58:37 +01:00
parent 0236a77c0b
commit aa43c7a69e
2 changed files with 2 additions and 2 deletions

View File

@ -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();

View File

@ -345,7 +345,7 @@ public final class TestCluster implements Iterable<Client> {
// prevent killing the master if possible
final Iterator<NodeAndClient> values = n == 0 ? nodes.values().iterator() : Iterators.filter(nodes.values().iterator(), Predicates.not(new MasterNodePredicate(getMasterName())));
final Iterator<NodeAndClient> 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<NodeAndClient> nodesToRemove = new HashSet<NodeAndClient>();
while (limit.hasNext()) {
NodeAndClient next = limit.next();