From bf543f073512af4d45ff61eb7290e05b84fd7ec8 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Thu, 20 Apr 2017 13:10:48 +0100 Subject: [PATCH] [TEST] Report more detail if waitForPendingTasks times out Original commit: elastic/x-pack-elasticsearch@63ca54b8510f69189c786b7e8a1f2195df88fecf --- .../xpack/ml/integration/MlRestTestStateCleaner.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/MlRestTestStateCleaner.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/MlRestTestStateCleaner.java index f1cabd41b79..62504dd67e9 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/MlRestTestStateCleaner.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/MlRestTestStateCleaner.java @@ -47,7 +47,8 @@ public class MlRestTestStateCleaner { private void waitForPendingTasks() throws Exception { ESTestCase.assertBusy(() -> { try { - Response response = adminClient.performRequest("GET", "/_cat/tasks"); + Response response = adminClient.performRequest("GET", "/_cat/tasks", + Collections.singletonMap("detailed", "true")); // Check to see if there are tasks still active. We exclude the // list tasks // actions tasks form this otherwise we will always fail @@ -58,10 +59,10 @@ public class MlRestTestStateCleaner { String line; StringBuilder tasksListString = new StringBuilder(); while ((line = responseReader.readLine()) != null) { - tasksListString.append(line); - tasksListString.append('\n'); if (line.startsWith(ListTasksAction.NAME) == false) { activeTasks++; + tasksListString.append(line); + tasksListString.append('\n'); } } assertEquals(activeTasks + " active tasks found:\n" + tasksListString, 0, activeTasks);