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

Refactor controller unit test with proper mock #269

Merged
merged 9 commits into from Apr 8, 2019

Conversation

Projects
None yet
5 participants
@zacharya
Copy link
Contributor

commented Apr 5, 2019

Is this a bug fix or adding new feature?
Refactor Cloud interface unit tests to use GoMock

What is this PR about? / Why do we need it?

  • Addresses #220 .
  • One thing to discuss - moving cloud.FakeCloudProvider to sanity.fakeCloudProvider required exporting cloud.metadata due to the dependency. I don't see any issues with this, but I figured I'd bring it up in case some of the maintainers see problems.

What testing is done?
Both make test and make test-sanity are running fine.

zacharya added some commits Apr 5, 2019

fin

@k8s-ci-robot k8s-ci-robot requested review from d-nishi and ddebroy Apr 5, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2019

Hi @zacharya. Thanks for your PR.

I'm waiting for a kubernetes-sigs or kubernetes 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/test-infra repository.

@coveralls

This comment has been minimized.

Copy link

commented Apr 5, 2019

Pull Request Test Coverage Report for Build 593

  • 22 of 26 (84.62%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+5.3%) to 70.394%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/driver/fakes.go 0 1 0.0%
pkg/driver/controller.go 12 15 80.0%
Files with Coverage Reduction New Missed Lines %
pkg/driver/controller.go 1 68.37%
Totals Coverage Status
Change from base Build 575: 5.3%
Covered Lines: 1001
Relevant Lines: 1422

💛 - Coveralls
@leakingtapan

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2019

/ok-to-test

zacharya added some commits Apr 5, 2019

@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 5, 2019

/retest

@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 5, 2019

/retest

@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 5, 2019

/retest

@leakingtapan

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2019

Im okay with making metadata struct public.

@leakingtapan
Copy link
Contributor

left a comment

Thx for send the PR. The testing code looks much cleaner and we have a higher coverage! I just finished half of the PR. will finish the rest.

Show resolved Hide resolved pkg/driver/controller_test.go
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go
Show resolved Hide resolved pkg/driver/controller_test.go
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/controller_test.go Outdated
Show resolved Hide resolved pkg/driver/node_test.go Outdated
@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

Thanks for the review. I'll knock these out first thing tomorrow.

@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

@leakingtapan I think I've touched on all of your suggestions. I went through each test case with the goal of making each more readable (rather than bring the dynamic error handling logic over from the previous state). Let me know if you see anything that still needs fixing.

@leakingtapan

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2019

/retest

1 similar comment
@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

/retest

@leakingtapan

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2019

The code a lot readable and more test covered now Thank @zacharya

/lgtm
/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Apr 8, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leakingtapan, zacharya

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 merged commit c67ab06 into kubernetes-sigs:master Apr 8, 2019

9 of 10 checks passed

tide Not mergeable.
Details
cla/linuxfoundation zacharya authorized
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+5.3%) to 70.394%
Details
pull-aws-ebs-csi-driver-e2e-multi-az Job succeeded.
Details
pull-aws-ebs-csi-driver-e2e-single-az Job succeeded.
Details
pull-aws-ebs-csi-driver-integration Job succeeded.
Details
pull-aws-ebs-csi-driver-sanity Job succeeded.
Details
pull-aws-ebs-csi-driver-unit Job succeeded.
Details
pull-aws-ebs-csi-driver-verify Job succeeded.
Details
@bertinatto

This comment has been minimized.

Copy link
Member

commented Apr 19, 2019

Just a heads up about this PR: we should always squash commits as much as possible.

@leakingtapan

This comment has been minimized.

Copy link
Contributor

commented Apr 19, 2019

+1 Forgot to remind @zacharya of doing this.

@zacharya

This comment has been minimized.

Copy link
Contributor Author

commented Apr 19, 2019

@bertinatto @leakingtapan Will do next time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.