[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();
builder = multiMatchQuery("value1", "field1", "field2", "field4");
try {
client().prepareSearch().setQuery(builder).get();
fail("Exception expected");
} catch (SearchPhaseExecutionException e) {
assertThat(e.shardFailures()[0].status(), equalTo(RestStatus.BAD_REQUEST));
}
assertFailures(client().prepareSearch().setQuery(builder),
RestStatus.BAD_REQUEST,
containsString("NumberFormatException[For input string: \"value1\"]"));
builder.lenient(true);
searchResponse = client().prepareSearch().setQuery(builder).get();