[TEST] check that primaries succeeded

We want to check if at least the primaries succeeded if we do not
wait for green and not if all succeeded if we wait for green.
That was a misconception in c617af37e8
This commit is contained in:
Britta Weber 2015-01-26 10:20:20 +01:00
parent aa6bf5fd1d
commit c3f1982f21
1 changed files with 2 additions and 2 deletions

View File

@ -79,7 +79,6 @@ public class DeleteByQueryTests extends ElasticsearchIntegrationTest {
client().prepareIndex("twitter", "tweet").setSource(json).setRefresh(true).execute().actionGet(); client().prepareIndex("twitter", "tweet").setSource(json).setRefresh(true).execute().actionGet();
ensureGreen("twitter");
SearchResponse search = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); SearchResponse search = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet();
assertThat(search.getHits().totalHits(), equalTo(1l)); assertThat(search.getHits().totalHits(), equalTo(1l));
DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = client().prepareDeleteByQuery(); DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = client().prepareDeleteByQuery();
@ -193,7 +192,8 @@ public class DeleteByQueryTests extends ElasticsearchIntegrationTest {
private void assertSyncShardInfo(ActionWriteResponse.ShardInfo shardInfo, NumShards numShards) { private void assertSyncShardInfo(ActionWriteResponse.ShardInfo shardInfo, NumShards numShards) {
assertThat(shardInfo.getTotal(), greaterThanOrEqualTo(numShards.totalNumShards)); assertThat(shardInfo.getTotal(), greaterThanOrEqualTo(numShards.totalNumShards));
assertThat(shardInfo.getSuccessful(), greaterThanOrEqualTo(numShards.totalNumShards)); // we do not ensure green so just make sure request succeeded at least on all primaries
assertThat(shardInfo.getSuccessful(), greaterThanOrEqualTo(numShards.numPrimaries));
assertThat(shardInfo.getPending(), equalTo(0)); assertThat(shardInfo.getPending(), equalTo(0));
assertThat(shardInfo.getFailed(), equalTo(0)); assertThat(shardInfo.getFailed(), equalTo(0));
for (ActionWriteResponse.ShardInfo.Failure failure : shardInfo.getFailures()) { for (ActionWriteResponse.ShardInfo.Failure failure : shardInfo.getFailures()) {