-
Notifications
You must be signed in to change notification settings - Fork 780
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: handle empty spec for modifyset #2585
Conversation
Signed-off-by: Alex Pana <[email protected]>
@@ -138,7 +138,7 @@ func MutatorForModifySet(modifySet *mutationsunversioned.ModifySet) (*Mutator, e | |||
return nil, fmt.Errorf("modifyset %s can't change metadata", modifySet.GetName()) | |||
} | |||
|
|||
if path.Nodes[len(path.Nodes)-1].Type() == parser.ListNode { | |||
if len(path.Nodes) > 0 && path.Nodes[len(path.Nodes)-1].Type() == parser.ListNode { |
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.
empty spec leads to empty path which panics. I've added unit tests for all mutators that don't have an empty spec test case to enforce graceful handling of an empty spec.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2585 +/- ##
=========================================
Coverage ? 53.58%
=========================================
Files ? 120
Lines ? 10634
Branches ? 0
=========================================
Hits ? 5698
Misses ? 4504
Partials ? 432
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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
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
Signed-off-by: Alex Pana <[email protected]> Co-authored-by: Max Smythe <[email protected]>
Signed-off-by: Alex Pana <[email protected]> Co-authored-by: Max Smythe <[email protected]>
Fixes #2574