Skip to content

Conversation

@tlrx
Copy link
Member

@tlrx tlrx commented Apr 20, 2017

I mixed up things in #24183 when adding the parse() method in InternalAggregationTestCase.

This pull request fixes InternalAggregationTestCase so that it always checks that the internal aggregation and the parsed aggregation always produce the same XContent (using assertToXContentEquivalent()) even when the original internal aggregation has been shuffled.

In InternalAggregationTestCase, we can check that the internal
aggregation and the parsed aggregation always produce the same XContent
  even if the original internal aggregation has been shuffled or not.
@tlrx tlrx added :Java High Level REST Client >non-issue >test Issues or PRs that are addressing/adding tests v6.0.0-alpha1 labels Apr 20, 2017
@tlrx tlrx requested a review from cbuescher April 20, 2017 10:33
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, left one minor comment


final BytesReference parsedBytes = toXContent((ToXContent) parsedAggregation, xContentType, params, humanReadable);
assertToXContentEquivalent(originalBytes, parsedBytes, xContentType);
final Aggregation parsedAggregation = parseAndAssert(aggregation, xContentType, randomBoolean(), randomBoolean());
Copy link
Member

Choose a reason for hiding this comment

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

Nit: could this by simplified even more by randomizing the xContentType, humanReadable and shuffle flag inside of parsedAggregation? Not sure about other callers of this method...

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, thanks for the suggestion

@tlrx tlrx merged commit d0df1ed into elastic:feature/client_aggs_parsing Apr 20, 2017
@tlrx
Copy link
Member Author

tlrx commented Apr 20, 2017

Thanks @cbuescher !

@tlrx tlrx deleted the update-internal-aggregation-test-case branch April 20, 2017 11:23
javanna pushed a commit to javanna/elasticsearch that referenced this pull request May 23, 2017
elastic#24208)

In InternalAggregationTestCase, we can check that the internal aggregation and the parsed aggregation always produce the same XContent even if the original internal aggregation has been shuffled or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue >test Issues or PRs that are addressing/adding tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants