-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Fix edge case in PutMappingRequestTests #37665
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I was wondering -- would it be a bit unintuitive for a user if they specified a non-null source, but then when going to inspect it, it is null? We could instead only modify the tests (perhaps always specifying a non-null source in
createTestInstance
, and adding a separate test to verify the null source behavior).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.
As far as I understand this parsing code only lives in the test? With the new client-side request that differ from the server side one (which eventually can be fully internal adfter the transport client removal) the parsing is done on the server side, so the user will always see their null-source still. Its only replaced by an empty object when sent.
To the contrary, when working on this fix got to the point where I think that we are overtesting these simple client-side POJOs (they are more or less structs with a toXContent and some validation methods). Having to dig around in AbstractXContentTestCase made me think which parts of it we really need. I'd really be in favour of making these simple ESTestCases, skip most of the randomization and only check all the possible code paths in the xContent output.
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.
Adding to this, I think the occasional
null
source is the only useful variant in this test at the moment since it checks that toXContent doesn't blow up on it.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.
Ah you're right, my original comment doesn't actually make sense. I hadn't yet had my morning coffee :)
I also like the idea of making this a simple
ESTestCase
-- are you planning to do this in the current PR? I'm also happy to merge this now, and improve this test in a separate PR if you'd prefer that.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.
No, I wasn't but I can sure do this as a follow up.