[TEST] AggregationsIntegrationIT#testScroll can timeout

This change sets the scroll timeout for this test to 1m instead of 500ms in order
to avoid loosing the scroll on slow machines.

Relates #26378
This commit is contained in:
Jim Ferenczi 2017-11-28 16:18:03 +01:00
parent d01fcee645
commit 37653c9dca
1 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import java.util.List;
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
@ -52,7 +53,7 @@ public class AggregationsIntegrationIT extends ESIntegTestCase {
public void testScroll() { public void testScroll() {
final int size = randomIntBetween(1, 4); final int size = randomIntBetween(1, 4);
SearchResponse response = client().prepareSearch("index") SearchResponse response = client().prepareSearch("index")
.setSize(size).setScroll(new TimeValue(500)) .setSize(size).setScroll(TimeValue.timeValueMinutes(1))
.addAggregation(terms("f").field("f")).get(); .addAggregation(terms("f").field("f")).get();
assertSearchResponse(response); assertSearchResponse(response);
Aggregations aggregations = response.getAggregations(); Aggregations aggregations = response.getAggregations();
@ -63,8 +64,9 @@ public class AggregationsIntegrationIT extends ESIntegTestCase {
int total = response.getHits().getHits().length; int total = response.getHits().getHits().length;
while (response.getHits().getHits().length > 0) { while (response.getHits().getHits().length > 0) {
response = client().prepareSearchScroll(response.getScrollId()) response = client().prepareSearchScroll(response.getScrollId())
.setScroll(new TimeValue(500)) .setScroll(TimeValue.timeValueMinutes(1))
.execute().actionGet(); .execute().actionGet();
assertSearchResponse(response);
assertNull(response.getAggregations()); assertNull(response.getAggregations());
total += response.getHits().getHits().length; total += response.getHits().getHits().length;
} }