[TEST] Report more detail if waitForPendingTasks times out

Original commit: elastic/x-pack-elasticsearch@63ca54b851
This commit is contained in:
David Roberts 2017-04-20 13:10:48 +01:00
parent bd58856e6f
commit bf543f0735
1 changed files with 4 additions and 3 deletions

View File

@ -47,7 +47,8 @@ public class MlRestTestStateCleaner {
private void waitForPendingTasks() throws Exception { private void waitForPendingTasks() throws Exception {
ESTestCase.assertBusy(() -> { ESTestCase.assertBusy(() -> {
try { 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 // Check to see if there are tasks still active. We exclude the
// list tasks // list tasks
// actions tasks form this otherwise we will always fail // actions tasks form this otherwise we will always fail
@ -58,10 +59,10 @@ public class MlRestTestStateCleaner {
String line; String line;
StringBuilder tasksListString = new StringBuilder(); StringBuilder tasksListString = new StringBuilder();
while ((line = responseReader.readLine()) != null) { while ((line = responseReader.readLine()) != null) {
tasksListString.append(line);
tasksListString.append('\n');
if (line.startsWith(ListTasksAction.NAME) == false) { if (line.startsWith(ListTasksAction.NAME) == false) {
activeTasks++; activeTasks++;
tasksListString.append(line);
tasksListString.append('\n');
} }
} }
assertEquals(activeTasks + " active tasks found:\n" + tasksListString, 0, activeTasks); assertEquals(activeTasks + " active tasks found:\n" + tasksListString, 0, activeTasks);