-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Test] Always check the XContent equivalent when parsing aggregations #24208
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
[Test] Always check the XContent equivalent when parsing aggregations #24208
Conversation
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.
cbuescher
left a comment
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
|
Thanks @cbuescher ! |
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.
I mixed up things in #24183 when adding the parse() method in
InternalAggregationTestCase.This pull request fixes
InternalAggregationTestCaseso that it always checks that the internal aggregation and the parsed aggregation always produce the same XContent (usingassertToXContentEquivalent()) even when the original internal aggregation has been shuffled.