Wait for task to start in reindex test

`RethrottleTests#testReindex` fail in CI:
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-intake/1274/console

I was unable to reproduce it locally but it *looks* like a race to start
the task. So I've added a wait for it to start just in case.
This commit is contained in:
Nik Everett 2016-08-17 12:07:04 -04:00
parent 2ea50bc162
commit 312a7d45ba
1 changed files with 3 additions and 0 deletions

View File

@ -57,6 +57,9 @@ public class RethrottleTests extends ReindexTestCase {
request.source().setSize(1); // Make sure we use multiple batches request.source().setSize(1); // Make sure we use multiple batches
ListenableActionFuture<? extends BulkIndexByScrollResponse> responseListener = request.execute(); ListenableActionFuture<? extends BulkIndexByScrollResponse> responseListener = request.execute();
// Wait for the task to start
assertBusy(() -> assertEquals(1, client().admin().cluster().prepareListTasks().setActions(actionName).get().getTasks().size()));
// Now rethrottle it so it'll finish // Now rethrottle it so it'll finish
ListTasksResponse rethrottleResponse = rethrottle().setActions(actionName).setRequestsPerSecond(Float.POSITIVE_INFINITY).get(); ListTasksResponse rethrottleResponse = rethrottle().setActions(actionName).setRequestsPerSecond(Float.POSITIVE_INFINITY).get();
assertThat(rethrottleResponse.getTasks(), hasSize(1)); assertThat(rethrottleResponse.getTasks(), hasSize(1));