-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 Matchers bug on ignored paths and add tests #5565
🐛 Fix Matchers bug on ignored paths and add tests #5565
Conversation
@sbueringer Can you let me know if this fixes the issues you encountered? |
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.
Thx for the very quick fix!!
Worked on my PR. A few nits, otherwise lgtm
originalWithModifiedJSON, err := jsonpatch.MergePatch(originalJSON, actualJSON) | ||
if err != nil { | ||
return nil, err | ||
} | ||
rawDiff, err := jsonpatch.CreateMergePatch(originalJSON, originalWithModifiedJSON) |
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.
Sorry I did not noticed this before, this is two-ways merge, but we need a plain merge patch like proposed in this change. Good catch
5031e32
to
68948a1
Compare
@killianmuldoon Thank you very much! lgtm +/- squash |
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 pending squash
Signed-off-by: killianmuldoon <[email protected]>
68948a1
to
f117a6c
Compare
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fabriziopandini The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: killianmuldoon [email protected]
This PR changes the logic inside the matchers to ensure that any difference in fields between the actual and original object - in either direction - is considered significant for establishing whether the objects are Equal. Previously the matcher did no consider fields in the original object that are not present in the modified object when matching.
This PR also adds unit tests to show the intended usage of the matcher in these, and other cases.
Note: This change significantly modifies the behaviour of the matcher library compared to the mergepatch library used in topology/internal. These changes make #5316 more difficult and less desirable.
Fixes #5563
/area testing