-
Notifications
You must be signed in to change notification settings - Fork 69
Add more test coverage for searialization and deserialization #303
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lalitc375 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @lalitc375. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Thanks! In addtion to this, I was hoping to merge some tests where the order of map keys and the spacing between delimiters (not just within the contents of strings) is not the same was what the serializer typically outputs. This would tease out issues where a streaming deserializer is accidentally sensitive to the order of the token stream or the whtiespace between tokens. Maybe somehow "randomize" a serialized managed field in a way that is still has the same data representation? Atypical whitespace chars and atypical usages of whitespace chars (multiple newlines, ...), randomized ordering of map entries ... |
/ok-to-test |
@@ -25,8 +27,10 @@ func TestPathElementRoundTrip(t *testing.T) { | |||
`f:`, | |||
`f:spec`, | |||
`f:more-complicated-string`, | |||
`f: string-with-spaces `, |
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 can't remember, do field-name encodings support any escaping or unescaping we need to exercise? (special characters, newlines, backslashes, non-ascii characters, etc)
Big +1 to this ... this PR is a great addition, we also want to exercise correct consumption of non-normalized outputs with non-semantic whitespace before / between / after tokens, and make sure the normalized output strips that out. |
Add cases mentioned in #292 (comment).
This pull request adds test coverage for serialization and deserialization of field paths, focusing on correctly handling spaces and invalid escape characters.
Description
This PR addresses cases mentioned in #292 (comment). The test suite is expanded to include tests for:
fieldpath/serialize-pe_test.go
,fieldpath/serialize_test.go
, andfieldpath/set_test.go
to ensure that leading and trailing spaces in field names and key values are preserved during serialization and deserialization round-trips.fieldpath/serialize-pe_test.go
to verify that an error is correctly returned when deserializing a path element that contains an invalid JSON escape sequence.These additions improve the robustness of the serialization and deserialization logic.