Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private void buildRow(Table table, boolean fullId, boolean detailed, DiscoveryNo
// Node information. Note that the node may be null because it has left the cluster between when we got this response and now.
table.addCell(fullId ? nodeId : Strings.substring(nodeId, 0, 4));
table.addCell(node == null ? "-" : node.getHostAddress());
table.addCell(node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getAddress().address().getPort());
table.addCell(node == null ? "-" : node.getName());
table.addCell(node == null ? "-" : node.getVersion().toString());
table.addCell(taskInfo.getHeaders().getOrDefault(Task.X_OPAQUE_ID, "-"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@
import org.opensearch.common.collect.MapBuilder;
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.action.ActionResponse;
import org.opensearch.core.tasks.TaskId;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.tasks.TaskInfo;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.client.NoOpNodeClient;
import org.opensearch.test.rest.FakeRestChannel;
import org.opensearch.test.rest.FakeRestRequest;

import java.util.List;
import java.util.Map;

import static java.util.Collections.emptyList;
import static org.opensearch.tasks.TaskInfoTests.randomResourceStats;
import static org.hamcrest.Matchers.is;

public class RestTasksActionTests extends OpenSearchTestCase {
Expand Down Expand Up @@ -77,7 +83,21 @@ public <Request extends ActionRequest, Response extends ActionResponse> void doE
Request request,
ActionListener<Response> listener
) {
listener.onResponse((Response) new ListTasksResponse(emptyList(), emptyList(), emptyList()));
final TaskInfo taskInfo = new TaskInfo(
new TaskId("test-node-id", randomLong()),
"test_type",
"test_action",
"test_description",
null,
randomLong(),
randomLongBetween(0, Long.MAX_VALUE),
false,
false,
TaskId.EMPTY_TASK_ID,
Map.of("foo", "bar"),
randomResourceStats(randomBoolean())
);
listener.onResponse((Response) new ListTasksResponse(List.of(taskInfo), emptyList(), emptyList()));
}
};
}
Expand Down
Loading