ElasticsearchAssertions.assertHitCount also checks shard failures

This commit is contained in:
Britta Weber 2013-08-28 10:32:59 +02:00
parent 60ac34ff3a
commit 513c761aee
1 changed files with 2 additions and 1 deletions

View File

@ -42,6 +42,7 @@ import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
import static org.elasticsearch.index.query.QueryBuilders.termQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery;
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.gaussDecayFunction; import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.gaussDecayFunction;
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class SearchWhileRelocatingTests extends AbstractSharedClusterTest { public class SearchWhileRelocatingTests extends AbstractSharedClusterTest {
@ -98,8 +99,8 @@ public class SearchWhileRelocatingTests extends AbstractSharedClusterTest {
functionScoreQuery(termQuery("test", "value"), functionScoreQuery(termQuery("test", "value"),
gaussDecayFunction("loc", lonlat, "1000km")).boostMode( gaussDecayFunction("loc", lonlat, "1000km")).boostMode(
CombineFunction.MULT.getName())))).get(); CombineFunction.MULT.getName())))).get();
assertHitCount(sr, (long) (numDocs));
final SearchHits sh = sr.getHits(); final SearchHits sh = sr.getHits();
assertThat("Expect num docs in getTotalHits() ",sh.getTotalHits(), equalTo((long) (numDocs)));
assertThat("Expected hits to be the same size the actual hits array", sh.getTotalHits(), assertThat("Expected hits to be the same size the actual hits array", sh.getTotalHits(),
equalTo((long) (sh.getHits().length))); equalTo((long) (sh.getHits().length)));
} }