[TEST] Stabelize test - wait for yellow to ensure all primaries are allocated

This commit is contained in:
Simon Willnauer 2014-06-14 21:52:15 +02:00
parent 7bcabf9481
commit 6d77a248fb
1 changed files with 2 additions and 2 deletions

View File

@ -320,7 +320,7 @@ public class RandomTests extends ElasticsearchIntegrationTest {
createIndex("idx"); createIndex("idx");
final int value = randomIntBetween(0, 10); final int value = randomIntBetween(0, 10);
indexRandom(true, client().prepareIndex("idx", "type").setSource("f", value)); indexRandom(true, client().prepareIndex("idx", "type").setSource("f", value));
ensureYellow("idx"); // only one document let's make sure all shards have an active primary
SearchResponse response = client().prepareSearch("idx") SearchResponse response = client().prepareSearch("idx")
.addAggregation(filter("filter").filter(FilterBuilders.matchAllFilter()) .addAggregation(filter("filter").filter(FilterBuilders.matchAllFilter())
.subAggregation(range("range") .subAggregation(range("range")
@ -330,7 +330,7 @@ public class RandomTests extends ElasticsearchIntegrationTest {
.subAggregation(sum("sum").field("f")))) .subAggregation(sum("sum").field("f"))))
.execute().actionGet(); .execute().actionGet();
assertSearchResponse(response);System.out.println(response); assertSearchResponse(response);
Filter filter = response.getAggregations().get("filter"); Filter filter = response.getAggregations().get("filter");
assertNotNull(filter); assertNotNull(filter);