[TEST] fixed SimpleQueryTests#testMultiMatchQuery check for shard failures

It can happen that not all shards are ready, thus we won't have a total failure, but we do need to check that we have at least a failure. Checked also the message of the failure.
This commit is contained in:
javanna 2014-03-12 00:55:17 +01:00 committed by Luca Cavanna
parent 7703183cef
commit 5378fd7901
1 changed files with 4 additions and 6 deletions

View File

@ -728,12 +728,10 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest {
refresh(); refresh();
builder = multiMatchQuery("value1", "field1", "field2", "field4"); builder = multiMatchQuery("value1", "field1", "field2", "field4");
try {
client().prepareSearch().setQuery(builder).get(); assertFailures(client().prepareSearch().setQuery(builder),
fail("Exception expected"); RestStatus.BAD_REQUEST,
} catch (SearchPhaseExecutionException e) { containsString("NumberFormatException[For input string: \"value1\"]"));
assertThat(e.shardFailures()[0].status(), equalTo(RestStatus.BAD_REQUEST));
}
builder.lenient(true); builder.lenient(true);
searchResponse = client().prepareSearch().setQuery(builder).get(); searchResponse = client().prepareSearch().setQuery(builder).get();