-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add modifycontroller SyncPVC unit tests #447
base: master
Are you sure you want to change the base?
Add modifycontroller SyncPVC unit tests #447
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: AndrewSirenko The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pvInformer := informerFactory.Core().V1().PersistentVolumes() | ||
pvcInformer := informerFactory.Core().V1().PersistentVolumeClaims() | ||
vacInformer := informerFactory.Storage().V1beta1().VolumeAttributesClasses() | ||
otherDriverPV := createTestPV(1, pvcName, pvcNamespace, "foobaz" /*pvcUID*/, &fsVolumeMode, testVac) |
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 seems like a code smell.
Happy to attempt to try to refactor resizer's testutils to implement Builder pattern to prevent by allowing developers to use MakePVC().WithXXX().WithYYY()
style in the test-cases themselves, similar to what k/k has.
This work was started in #402, but was pushed back to once all-in-one sidecar project is here.
|
||
controller := NewModifyController(driverName, | ||
csiModifier, kubeClient, | ||
0, false, informerFactory, |
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.
Note that I have set resync period to 0 because shared_informer does not support resyncing:
W1023 19:04:49.983836 13491 shared_informer.go:569] The specified resyncPeriod 1s is invalid because this shared informer doesn't support resyncing
This also let us cut out any sleeps in unit tests (instant tests!)
f64fade
to
e5067f5
Compare
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Add modifycontroller SyncPVC unit tests. Including a retro-active unit test for #422.
Also de-duplicate/document some of the unit test boilerplate to help new contributors understand the code.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
/hold
There are a couple of questions in PR marked
TODO Q
.Does this PR introduce a user-facing change?: