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

Created unit tests for GCE cloud provider storage interface. #44884

Merged
merged 1 commit into from
May 26, 2017

Conversation

verult
Copy link
Contributor

@verult verult commented Apr 24, 2017

  • Currently covers CreateDisk and DeleteDisk, GetAutoLabelsForPD
  • Created ServiceManager interface in gce.go to facilitate mocking in tests.

What this PR does / why we need it:
Increasing test coverage for GCE Persistent Disk.

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

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 24, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @verult. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot 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.

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. I understand the commands that are listed here.

@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 Apr 24, 2017
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 24, 2017
@verult
Copy link
Contributor Author

verult commented Apr 25, 2017

/approve

1 similar comment
@verult
Copy link
Contributor Author

verult commented Apr 25, 2017

/approve

@verult
Copy link
Contributor Author

verult commented Apr 25, 2017

/assign @msau42 @jingxu97

@cblecker
Copy link
Member

@k8s-bot ok to test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 25, 2017
@caesarxuchao caesarxuchao removed their assignment Apr 25, 2017
@luxas luxas assigned roberthbailey and unassigned luxas Apr 25, 2017
@verult verult force-pushed the master branch 3 times, most recently from 0dfb427 to e818754 Compare April 26, 2017 20:01
}

type ServiceManager interface {
CreateDisk(
Copy link
Member

Choose a reason for hiding this comment

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

Can you add comments to each functions in the interface?

t.Error("Ops used in WaitForZoneOp does not match what's returned by CreateDisk.")
}
// Partial check of equality between disk description sent to GCE and parameters of method.
if fakeManager.diskToCreate.Name != diskName || fakeManager.diskToCreate.SizeGb != sizeGb {
Copy link
Member

Choose a reason for hiding this comment

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

I would also verify the tags, and diskTypeUri fields. And make each field a separate check.

t.Errorf("Error creating disk in zone '%v'; error: \"%v\"", zone, err)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Another test case for CreateDisk is the disk was already created.

@msau42
Copy link
Member

msau42 commented Apr 27, 2017

Also instead of calling it GCE storage class, I would call it GCE cloud provider storage interface. We have a Kubernetes concept called storage classes, which is totally different than this.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 28, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 28, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2017
@verult verult changed the title Created unit tests for GCE storage class. Created unit tests for GCE cloud provider storage interface. May 16, 2017
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 16, 2017

type ServiceManager interface {
// Creates a new persistent disk on GCE with the given disk spec.
CreateDisk(
Copy link
Member

Choose a reason for hiding this comment

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

To conform with the rest of the files, can you put all the arguments on the same line?

@verult
Copy link
Contributor Author

verult commented May 24, 2017

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels May 24, 2017
- Currently covers CreateDisk and DeleteDisk, GetAutoLabelsForPD
- Created ServiceManager interface in gce.go to facilitate mocking in tests.
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented May 24, 2017

@verult: The following test(s) failed:

Test name Commit Details Rerun command
pull-kubernetes-federation-e2e-gce 2141b0f link @k8s-bot pull-kubernetes-federation-e2e-gce test this

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@msau42
Copy link
Member

msau42 commented May 24, 2017

@k8s-bot pull-kubernetes-unit test this

@msau42
Copy link
Member

msau42 commented May 25, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 25, 2017
@jingxu97
Copy link
Contributor

/approve

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jingxu97, msau42, verult

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 46383, 45645, 45923, 44884, 46294)

@k8s-github-robot k8s-github-robot merged commit f8cfeef into kubernetes:master May 26, 2017
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. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit testing: GCE cloud provider disks