Skip to content

Commit

Permalink
Relax check in AsyncSearchActionIT#testMaxResponseSize
Browse files Browse the repository at this point in the history
This new check can fail rarely because the exception is nested in different ways
depending on the cluster set-up.
  • Loading branch information
jtibshirani committed Sep 23, 2021
1 parent 2fe41c1 commit 5a8c035
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public void testSearchPhaseFailure() throws Exception {
ensureTaskNotRunning(response.getId());
}

public void testMaxResponseSize() throws Exception {
public void testMaxResponseSize() {
SearchSourceBuilder source = new SearchSourceBuilder()
.query(new MatchAllQueryBuilder())
.aggregation(AggregationBuilders.terms("terms").field("terms.keyword").size(numKeywords));
Expand All @@ -476,14 +476,10 @@ public void testMaxResponseSize() throws Exception {
updateSettingsRequest.transientSettings(Settings.builder().put("search.max_async_search_response_size", limit + "b"));
assertAcked(client().admin().cluster().updateSettings(updateSettingsRequest).actionGet());

ExecutionException e = expectThrows(ExecutionException.class,
() -> submitAsyncSearch(request));
ExecutionException e = expectThrows(ExecutionException.class, () -> submitAsyncSearch(request));
assertNotNull(e.getCause());

assertThat(e.getCause(), instanceOf(IllegalArgumentException.class));
assertEquals("Can't store an async search response larger than [" + limit + "] bytes. " +
"This limit can be set by changing the [" + MAX_ASYNC_SEARCH_RESPONSE_SIZE_SETTING.getKey() + "] setting.",
e.getCause().getMessage());
assertThat(e.getMessage(), containsString("Can't store an async search response larger than [" + limit + "] bytes. " +
"This limit can be set by changing the [" + MAX_ASYNC_SEARCH_RESPONSE_SIZE_SETTING.getKey() + "] setting."));

updateSettingsRequest = new ClusterUpdateSettingsRequest();
updateSettingsRequest.transientSettings(Settings.builder().put("search.max_async_search_response_size", (String) null));
Expand Down

0 comments on commit 5a8c035

Please sign in to comment.