kubernetes-sigs / vsphere-csi-driver

vSphere storage Container Storage Interface (CSI) plugin
https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/index.html
Apache License 2.0
289 stars 173 forks source link

CSI unit tests framework improvement #2865

Closed vdkotkar closed 2 months ago

vdkotkar commented 3 months ago

What this PR does / why we need it: This PR has changes to improve CSI unit test framework.

  1. Added a common function to get VC instance using vcsim as per requirement like number of datacenters, clusters, hosts, VMs, datastores etc.
  2. Updated node manager interface used for testing by registering nodes generated using vcsim
  3. Updated GetSharedDatastoresInK8sCluster function in unit test to test actual functions instead of using mock code
  4. Updated wcp controller unit test to test actual GetCandidateDatastoresInCluster function instead of using mock code
  5. Added a framework for writing unit tests around topology like creating a volume with specified AccessibilityRequirements
  6. Added a unit test to create category and tag using tag manager and attach tag to objects like datacenter, cluster etc.
  7. Added few negative test scenarios
  8. Added new option "make coverprofile", which runs all unit tests and opens coverage report at file level in the default browser.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Testing done: All unit tests are passing when run using "make test" command

Special notes for your reviewer:

Release note:

CSI unit tests framework improvement
k8s-ci-robot commented 3 months ago

Hi @vdkotkar. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
divyenpatel commented 3 months ago

/ok-to-test

deepakkinni commented 2 months ago

/approve

k8s-ci-robot commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepakkinni, divyenpatel, vdkotkar

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/vsphere-csi-driver/blob/master/OWNERS)~~ [deepakkinni,divyenpatel] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment