Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discoveryNodes must be set before calling toXContent error when calling prepareListTasks().get() #19772

Closed
dadoonet opened this issue Aug 3, 2016 · 0 comments
Assignees
Labels

Comments

@dadoonet
Copy link
Member

dadoonet commented Aug 3, 2016

When writing an integration test which extends ESIntegTestCase and trying to list existing tasks with client().admin().cluster().prepareListTasks().get(), I'm getting:

[2016-08-02 23:41:37,884][WARN ][org.elasticsearch.test.transport] [transport_client_node_sd1] Failed to receive message for action [cluster:monitor/tasks/lists]
java.lang.IllegalStateException: discoveryNodes must be set before calling toXContent with group_by=nodes
    at org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse.toXContent(ListTasksResponse.java:159)
    at org.elasticsearch.common.Strings.toString(Strings.java:901)
    at org.elasticsearch.common.Strings.toString(Strings.java:887)
    at org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse.toString(ListTasksResponse.java:208)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertVersionSerializable(ElasticsearchAssertions.java:678)
    at org.elasticsearch.test.transport.AssertingLocalTransport.handleParsedResponse(AssertingLocalTransport.java:85)
    at org.elasticsearch.transport.local.LocalTransport.handleResponse(LocalTransport.java:386)
    at org.elasticsearch.transport.local.LocalTransport.processReceivedMessage(LocalTransport.java:292)
    at org.elasticsearch.transport.local.LocalTransport.lambda$receiveMessage$0(LocalTransport.java:252)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:450)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
@dadoonet dadoonet added the >bug label Aug 3, 2016
@dadoonet dadoonet self-assigned this Aug 3, 2016
dadoonet added a commit to dadoonet/elasticsearch that referenced this issue Aug 3, 2016
We just overwrite `toString()` method so it calls toXContent
with `group_by` = "whatever" so we don't try to group by nodes
which does not make sense in a toString() method.

We keep the old behavior for `toXContent()` method which
means that there is no impact in the REST layer but
only in logs and tests (where we call `toString()`).

Closes elastic#19772.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant