-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(test): use builder to build test objects. #955
Conversation
3963cac
to
c566103
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #955 +/- ##
==========================================
- Coverage 67.51% 67.35% -0.16%
==========================================
Files 30 30
Lines 3128 3128
==========================================
- Hits 2112 2107 -5
- Misses 848 852 +4
- Partials 168 169 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@jvanz this looks great, few comments below:
|
7b57b93
to
4afac1c
Compare
@kubewarden/kubewarden-developers I've rewrite all the factories function from the right after pushing the code I had another idea. Which is using a factory method with variable argument to define the objects configuration. For example: admissionPolicyFactory(withName("foo"), withPolicyServer("default"))
// or
admissionPolicyFactory(withName("foo"), withPolicyServer("default"), withMutating(true)) Something similar to what other go projects do to customize configuration. But I'm not sure what do you prefer. I do have have any string preference on either options. I just want to share all the paths with you. Another thing, I'm not migrating the factories from the |
Creates builders to allow dynamic object building during tests. Signed-off-by: José Guilherme Vanz <[email protected]>
4afac1c
to
f17d163
Compare
I think that what we have now is clearer than functional options |
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, thanks for the changes
Description
Creates builders to allow dynamic object building during tests.
Part of #824
@kubewarden/kubewarden-developers this is one of a series of PR open to refactor the webhooks tests. This is a initial change to use builder pattern to build (hehe) test objects. This is not a 100% convertion. But it's a start to see if you are all fine with the current changes before the next one following the same idea.