From 312a7d45ba4662d11dbb5981cd3b826c9c924ca0 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 17 Aug 2016 12:07:04 -0400 Subject: [PATCH] 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. --- .../java/org/elasticsearch/index/reindex/RethrottleTests.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RethrottleTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RethrottleTests.java index 38f9dbc6d97..7abd1212f6c 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RethrottleTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RethrottleTests.java @@ -57,6 +57,9 @@ public class RethrottleTests extends ReindexTestCase { request.source().setSize(1); // Make sure we use multiple batches ListenableActionFuture 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 ListTasksResponse rethrottleResponse = rethrottle().setActions(actionName).setRequestsPerSecond(Float.POSITIVE_INFINITY).get(); assertThat(rethrottleResponse.getTasks(), hasSize(1));