-
Notifications
You must be signed in to change notification settings - Fork 98
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
Create unit-test helper functions #301
Conversation
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.
This pull request does not contain a valid label. Please add one of the following labels: bug, enhancement, documentation
Codecov Report
@@ Coverage Diff @@
## main #301 +/- ##
=======================================
Coverage 58.22% 58.22%
=======================================
Files 59 59
Lines 6300 6300
=======================================
Hits 3668 3668
Misses 2362 2362
Partials 270 270
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
233c0a2
to
f6aee9b
Compare
f6aee9b
to
60a3d14
Compare
} | ||
|
||
// CheckLabelIsNotPresent used to check if a label (key,value) is not present on a metav1.ObjectMeta object. | ||
func CheckLabelIsNotPresent(key string) CheckObjectMeta { |
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 the functions return the CheckObjectMeta
meta type, we cannot easily combine them, e.g. wrapping CheckLabelIsPresent
in a not
or something, meaning that we'll have to provide a helper each time (regexp, not regexp, etc.)
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.
Do you see a solution?
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.
Maybe we could change to func Check(runtime.Object) bool
and use a typed struct to inject other parameters.
Something like:
CheckLabelIsPresent{label: <some_key>}
with func (*CheckLabelIsPresent) Check(runtime.Object) bool
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.
@vboulineau done
What does this PR do?
Create new unittest helper to verify specific part of a PodTemplate, DS, EDS
Motivation
easy unit-tests maintenance
Additional Notes
Anything else we should know when reviewing?
Describe your test plan
Write there any instructions and details you may have to test your PR.