From c3f1982f21150336f87b7b4def74e019e8bdac18 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Mon, 26 Jan 2015 10:20:20 +0100 Subject: [PATCH] [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 c617af37e830b77da73d3e36327f5590ba226468 --- .../org/elasticsearch/deleteByQuery/DeleteByQueryTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java b/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java index 4952d407c52..1dd76b1fa6c 100644 --- a/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java +++ b/src/test/java/org/elasticsearch/deleteByQuery/DeleteByQueryTests.java @@ -79,7 +79,6 @@ public class DeleteByQueryTests extends ElasticsearchIntegrationTest { client().prepareIndex("twitter", "tweet").setSource(json).setRefresh(true).execute().actionGet(); - ensureGreen("twitter"); SearchResponse search = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); assertThat(search.getHits().totalHits(), equalTo(1l)); DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = client().prepareDeleteByQuery(); @@ -193,7 +192,8 @@ public class DeleteByQueryTests extends ElasticsearchIntegrationTest { private void assertSyncShardInfo(ActionWriteResponse.ShardInfo shardInfo, NumShards numShards) { 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.getFailed(), equalTo(0)); for (ActionWriteResponse.ShardInfo.Failure failure : shardInfo.getFailures()) {