-
Notifications
You must be signed in to change notification settings - Fork 50
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
test: add unit tests #18
Conversation
Hi @fengzixu. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @fengzixu |
@fengzixu thanks for doing this 👍 |
/ok-to-test |
@fengzixu CI failed with this error: I think you need to use the latest csi-test which has ControllerGetVolume. |
@xing-yang Yep. Let me update me |
Looks like CI still complained about ControllerGetVolume not defined. |
0382136
to
90913a3
Compare
@xing-yang test has passed |
@xing-yang Hi Xing. All unit test cases have been added. |
Can you squash your commits? |
2ea125d
to
bd1792b
Compare
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.
I just added a couple of more comments. Looks good other than that.
pkg/agent/agent_test.go
Outdated
Message: "Volume not found", | ||
}, | ||
}, | ||
NativeVolume: mock.CreatePV(2, "pvc", "pv", mock.DefaultNS, "abnormalVolume1", "pvcuid", &mock.FSVolumeMode, v1.VolumePending), |
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.
We are only checking volumes that are bound. If volumes are not bound, there should already be events generated by the existing controllers. Also the Message says "Volume not found" which does not match "Pending".
So change v1.VolumePending to v1.Bound
Rename "Test_AbnormalVolumeVolumePending" to "Test_AbnormalVolumeIOError". Change Message from "Volume not found" to "IO error".
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.
Only test different error message looks like not necessary. Let me remove this test case
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fengzixu, xing-yang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR added some unit tests for
csi-handler
andutil
packageWhich issue(s) this PR fixes:
Fixes #11
Special notes for your reviewer:
Rely on: kubernetes-csi/csi-test#276
Does this PR introduce a user-facing change?: