Closed AndrewSirenko closed 1 month ago
Hi @AndrewSirenko. Thanks for your PR.
I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: AndrewSirenko Once this PR has been reviewed and has the lgtm label, please assign gnufied for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
/ok-to-test
@AndrewSirenko Please refactor all the test code with the new library if possible. It makes the test code more readable and maintainable.
Hey @carlory I refactored most of the unit tests and also added in PVWrapper to testutil
for consistency. I will do a final deep comb through for any places I've missed (like a few lines in util_test.go
), but would you be able to skim through some of my changes to confirm I'm on the right track?
Also, I've been keeping the convenience functions like makeTestPVC
in each package intact. Is this fine or in an ideal world we'd want to get rid of them such that most WithXXX()
s happen within the testcase definitions?
Firstly, thanks for working on this task. It's not a blocker for the beta target.
The builder pattern wraps an object inside and returns the inner object after setting the properties via a series of chained methods. The following benefits are:
We can see lots of examples in k8s.io/kubernetes
. i.e.
So I added a suggestion to the previous PR and hope to reduce the code duplication in the pkg/modifycontroller
and pkg/resizer
directories if possible.
Finally, after I deeply read the code and tried to add some changes, it may increase the complexity and the benefits are not obvious. So we can ignore this suggestion. What do you think? @AndrewSirenko
cc @msau42
Closing PR, discussed that refactoring to builder pattern may be desirable once all sidecars are in one.
What type of PR is this?
/kind cleanup
What this PR does / why we need it: This PR refactors test files for external-resizer as @carlory requested in PR 351.
It makes
MakePVC
simpler by letting developers use useMakePVC().WithXXX().WithYYY()
to implement an expected PVC.Finally, this PR refactors helper functions previously in
testutil
to use this pattern and moves them to their respective packages as requested.Which issue(s) this PR fixes:
Partially addresses #367
Special notes for your reviewer:
Does this PR introduce a user-facing change?: