Skip to content
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 more unit tests to increase test coverage #2089

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

ElijahQuinones
Copy link
Member

Is this a bug fix or adding new feature?
This adds more units tests for more code coverage.

What is this PR about? / Why do we need it?
As driver and Cloud coverage are both below 90% coverage this PR is to add more coverage to those areas

What testing is done?
Ran the unit tests to validate they pass and ran make test/coverage to verify that the coverage had increased after each unit test was added

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 18, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 18, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @ElijahQuinones. 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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 18, 2024
@ElijahQuinones
Copy link
Member Author

This initial PR is just to get feedback from the team so the rest of the tests going forward that I write can conform to the same format.

@torredil
Copy link
Member

/ok-to-test

This initial PR is just to get feedback from the team so the rest of the tests going forward that I write can conform to the same format.

@ElijahQuinones It's looking good!- inputs/outputs are being parameterized which makes sense and the tests are written in a table-driven manner, which is considered a best practice.

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 18, 2024
@AndrewSirenko
Copy link
Contributor

Looks great to me so far! +1 To eddie's points. Readable tests with no over-reliance on mocking is a great sign as well.

Copy link

github-actions bot commented Jul 19, 2024

Code Coverage Diff

File Old Coverage New Coverage Delta
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/cloud.go 85.7% 88.9% 3.2
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/handlers.go 0.0% 4.8% 4.8
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/controller.go 82.8% 83.8% 1.0
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/controller_modify_volume.go 72.3% 78.3% 6.0
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/driver.go 0.0% 26.3% 26.3
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/validation.go 87.8% 97.3% 9.5

pkg/driver/controller.go Outdated Show resolved Hide resolved
pkg/driver/driver.go Outdated Show resolved Hide resolved
pkg/driver/validation.go Outdated Show resolved Hide resolved
pkg/cloud/cloud_test.go Outdated Show resolved Hide resolved
pkg/cloud/cloud_test.go Outdated Show resolved Hide resolved
pkg/cloud/cloud_test.go Show resolved Hide resolved
pkg/driver/controller.go Outdated Show resolved Hide resolved
pkg/driver/validation_test.go Outdated Show resolved Hide resolved
pkg/driver/validation.go Outdated Show resolved Hide resolved
pkg/driver/driver.go Outdated Show resolved Hide resolved
pkg/driver/controller_modify_volume_test.go Show resolved Hide resolved
pkg/driver/driver_test.go Outdated Show resolved Hide resolved
@ElijahQuinones
Copy link
Member Author

/retest

pkg/driver/driver.go Outdated Show resolved Hide resolved
pkg/driver/validation.go Outdated Show resolved Hide resolved
pkg/cloud/cloud_test.go Show resolved Hide resolved
Copy link
Contributor

@ConnorJC3 ConnorJC3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs squash, otherwise lgtm

pkg/cloud/cloud_test.go Outdated Show resolved Hide resolved
pkg/cloud/cloud_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 6, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 7, 2024
@ConnorJC3
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2024
@torredil
Copy link
Member

torredil commented Aug 7, 2024

/lgtm

@torredil
Copy link
Member

torredil commented Aug 7, 2024

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: torredil

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit 18d2c19 into kubernetes-sigs:master Aug 7, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants