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

High-level client: list tasks failure to not lose nodeId #31001

Merged
merged 2 commits into from
Jun 1, 2018

Conversation

javanna
Copy link
Member

@javanna javanna commented May 31, 2018

This commit reworks testing for ListTasksResponse so that random
fields insertion can be tested and xcontent equivalence can be checked
too. Proper exclusions need to be configured, and failures need to be
tested separately. This helped finding a little problem, whenever there
is a node failure returned, the nodeId was lost as it was never printed
out as part of the exception toXContent.

This commit reworks testing for `ListTasksResponse` so that random
fields insertion can be tested and xcontent equivalence can be checked
too. Proper exclusions need to be configured, and failures need to be
tested separately. This helped finding a little problem, whenever there
is a node failure returned, the nodeId was lost as it was never printed
out as part of the exception toXContent.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I left one comment regarding documenting the special case in the tests a bit more and left a question, but that is nothing that needs another review I think

}

@Override
protected ListTasksResponse createTestInstance() {
//failures are tested separately, so we can test xcontent equivalence at least when we have no failures
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@Override
protected boolean assertToXContentEquivalence() {
return false;
public void testFromXContentWithFailures() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you add a comment what the actual goal of this test is, and what the failure scenario is?
I kind of figured it out from the comment inside I think, but having it as a method comment would speed up reading on later occasions.
From what I got so far: we don't really want to test that parsing works (i.e. we don't assert anything on the result), but only that it doesn' break. The failure source in this case would be random fields inside the task/nodefailures objects, thats why those are not mentioned in getRandomFieldsExcludeFilter
Anything I'm missing? Is this more or less correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a comment, we actually assert on everything, this is a normal testFromXContent with the only difference that we disabled assertToXContentEquivalence ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I knew how to read these tests but apparently I missed that. See what you mean now. Even one more reason to make life easier for future-me by adding a comment. Thanks.

pcsanwald pushed a commit to pcsanwald/elasticsearch that referenced this pull request May 31, 2018
@javanna javanna merged commit 31351ab into elastic:master Jun 1, 2018
javanna added a commit that referenced this pull request Jun 1, 2018
This commit reworks testing for `ListTasksResponse` so that random
fields insertion can be tested and xcontent equivalence can be checked
too. Proper exclusions need to be configured, and failures need to be
tested separately. This helped finding a little problem, whenever there
is a node failure returned, the nodeId was lost as it was never printed
out as part of the exception toXContent.
dnhatn added a commit that referenced this pull request Jun 2, 2018
* 6.x:
  Adjust BWC version on client features
  Introduce client feature tracking (#31020)
  [DOCS] Make geoshape docs less memory hungry (#31014)
  Fix handling of percent-encoded spaces in Windows batch files (#31034)
  [Docs] Fix a typo in Create Index naming limitation (#30891)
  REST high-level client: add delete ingest pipeline API (#30865)
  Ensure that index_prefixes settings cannot be changed (#30967)
  REST high-level client: add get ingest pipeline API (#30847)
  Cross Cluster Search: preserve remote status code (#30976)
  High-level client: list tasks failure to not lose nodeId (#31001)
  Refactor Sniffer and make it testable (#29638)
  [ML][TEST] Fix bucket count assertion in all tests in ModelPlotsIT (#31026)
  Add an option to split keyword field on whitespace at query time (#30691)
  Allow rollup job creation only if cluster is x-pack ready (#30963)
  Fix interoperability with < 6.3 transport clients (#30971)
  [Tests] Fix alias names in PutIndexTemplateRequestTests (#30960)
  [DOCS] Fixes links (#31011)
  Watcher: Give test a little more time
dnhatn added a commit that referenced this pull request Jun 2, 2018
* master:
  Avoid randomization bug in FeatureAwareTests
  Adjust BWC version on client features
  Add TRACE, CONNECT, and PATCH http methods (#31035)
  Adjust BWC version on client features
  [DOCS] Make geoshape docs less memory hungry (#31014)
  Fix handling of percent-encoded spaces in Windows batch files (#31034)
  [Docs] Fix a typo in Create Index naming limitation (#30891)
  Introduce client feature tracking (#31020)
  Ensure that index_prefixes settings cannot be changed (#30967)
  REST high-level client: add delete ingest pipeline API (#30865)
  [ML][TEST] Fix bucket count assertion in all tests in ModelPlotsIT (#31026)
  Allow rollup job creation only if cluster is x-pack ready (#30963)
  Fix interoperability with < 6.3 transport clients (#30971)
  Add an option to split keyword field on whitespace at query time (#30691)
  [Tests] Fix alias names in PutIndexTemplateRequestTests (#30960)
  REST high-level client: add get ingest pipeline API (#30847)
  Cross Cluster Search: preserve remote status code (#30976)
  High-level client: list tasks failure to not lose nodeId (#31001)
  [DOCS] Fixes links (#31011)
  Watcher: Give test a little more time
  Reuse expiration date of trial licenses (#30950)
  Remove unused query methods from MappedFieldType. (#30987)
  Transport client: Don't validate node in handshake (#30737)
  [DOCS] Clarify not all PKCS12 usable as truststores (#30750)
  HLRest: Allow caller to set per request options (#30490)
  Remove version read/write logic in Verify Response (#30879)
  [DOCS] Update readme for testing x-pack code snippets (#30696)
  Ensure intended key is selected in SamlAuthenticatorTests (#30993)
  Core: Remove RequestBuilder from Action (#30966)
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants