[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 {
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);