-
Notifications
You must be signed in to change notification settings - Fork 251
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
docs on e2e testing for CSI plugins #143
Conversation
Hi @mathu97. Thanks for your PR. I'm waiting for a kubernetes-csi or kubernetes 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. |
6d5882f
to
73af8a2
Compare
/ok-to-test |
book/src/e2e-testing.md
Outdated
|
||
* For example the [NFS CSI plugin](https://github.com/kubernetes-csi/csi-driver-nfs) does not support dynamic provisoning, so we would want to skip those and run only pre-provisioned tests. For such cases, you would need to write your own testdriver, which is discussed below. | ||
|
||
In-tree storage e2e tests could be used to test CSI storage plugins. Your repo could be setup similar to how this [NFS CSI plugin](https://github.com/mathu97/csi-driver-nfs/) is setup, where the testfiles are in a test directory and the main test file is in the cmd directory. |
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.
Can we check this into the nfs driver repo so we have a stable path?
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.
Ya I was thinking that too. I'll work on a PR.
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.
Also the ability to import e2e tests came in Kubernetes 1.14, and it would be required for the driver to use that. The nfs driver currently uses Kubernetes 1.12, so that would need to be updated. How would this work, if I wanted to update the kubernetes version for csi-driver-nfs?
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.
bump everything in Gopkg.toml to *1.14 from *1.12 and dep ensure
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.
Created a PR to add this to the nfs driver repo. Would need to update the links.
book/src/e2e-testing.md
Outdated
|
||
In-tree storage e2e tests could be used to test CSI storage plugins. Your repo could be setup similar to how this [NFS CSI plugin](https://github.com/mathu97/csi-driver-nfs/) is setup, where the testfiles are in a test directory and the main test file is in the cmd directory. | ||
|
||
To be able import the in-tree storage tests, CSI plugin authors would need to implement a [testdriver](https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/testsuites/testdriver.go#L31) for their CSI plugin. The testdriver provides required functionality that would help setup testcases for a particular plugin. |
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.
It should be noted somewhere that the version of the test library that you import is tied to the Kubernetes version. For example, the 1.13+ version of the e2e tests runs the raw block tests by default, since the feature went beta in 1.13. If you ran it against a 1.12 cluster, it would fail if you didn't enable the alpha feature.
book/src/e2e-testing.md
Outdated
- `SkipUnsupportedTest(pattern testpatterns.TestPattern)` | ||
- `PrepareTest(f *framework.Framework) (*testsuites.PerTestConfig, func())` | ||
|
||
The `PrepareTest` method is important as it is where you will write code to deploy your driver and setup other pre-requistes that your driver requires. The nfs and hostpath testdrivers deploy the plugin by simply [using the manifests files](https://github.com/mathu97/csi-driver-nfs/blob/master/test/nfs_driver.go#L91) that you would regularly use to deploy a plugin. |
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.
In tree we bring up/down the driver per test case. For running out-of-tree in a driver-specific repo, I would encourage folks to bring up their driver at the beginning/before the test instead of per-test.
book/src/e2e-testing.md
Outdated
|
||
Depending on your plugin's specs, you would implement other driver interaces defined [here](https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/testsuites/testdriver.go#L61). For example the [NFS testdriver](https://github.com/mathu97/csi-driver-nfs/blob/master/test/nfs_driver.go) also implements PreprovisionedVolumeTestDriver, and PreprovisionedPVTestDriver interfaces, to enable pre-provisoned tests. | ||
|
||
After implementing the tesdriver for your CSI plugin, you would create a `csi-volumes.go` file, where the implemented testdriver is used to run in-tree storage test suites [similar to how the NFS testdriver does](https://github.com/mathu97/csi-driver-nfs/blob/master/test/csi-volumes.go#L38). |
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.
typo: testdriver
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.
Also mention here that this is where you define which test suites you want to run. And you can find the list of all test suites at __
/assign @pohly |
@mathu97: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. 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. |
@msau42 I pushed a commit according to your review. Let me know what you think. |
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.
Mostly lgtm, just some minor comments. You can squash you commits
book/src/e2e-testing.md
Outdated
## Setting up End to End tests for your CSI Plugin | ||
|
||
### Prerequisites: | ||
* A Kubernetes v1.12+ Cluster |
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.
This should be updated to 1.14?
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.
It works with 1.13 as well, but does not with 1.12. I will update it.
book/src/e2e-testing.md
Outdated
|
||
In-tree storage e2e tests could be used to test CSI storage plugins. Your repo should be setup similar to how the [NFS CSI plugin](https://github.com/kubernetes-csi/csi-driver-nfs/) is setup, where the testfiles are in a `test` directory and the main test file is in the `cmd` directory. | ||
|
||
To be able import Kubernetes in-tree storage tests, the CSI plugin would need to use **Kubernetes v1.14+** (add to plugin's GoPkg.toml, since pluggable E2E tests become available in v1.14). CSI plugin authors would also be required to implement a [testdriver](https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/testsuites/testdriver.go#L31) for their CSI plugin. The testdriver provides required functionality that would help setup testcases for a particular plugin. |
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.
for any links that are pointing to specific line numbers, can you use an url with a specific commit/tag instead of master?
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.
Yes that makes more sense
book/src/testing-drivers.md
Outdated
* [Functional Testing](functional-testing.md) | ||
* [End To End Testing](e2e-tests.md) |
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.
Add Kubernetes to the title and page name
* [Functional Testing](functional-testing.md) |
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.
The functional page was intended for the K8s e2es I believe. Can we merge the two pages somehow?
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.
Yes it does. Should I copy over e2e-tests.md to this page?
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 merged the two pages and squashed the commits.
book/src/functional-testing.md
Outdated
|
||
In-tree storage e2e tests could be used to test CSI storage plugins. Your repo should be setup similar to how the [NFS CSI plugin](https://github.com/kubernetes-csi/csi-driver-nfs/) is setup, where the testfiles are in a `test` directory and the main test file is in the `cmd` directory. | ||
|
||
To be able import Kubernetes in-tree storage tests, the CSI plugin would need to use **Kubernetes v1.14+** (add to plugin's GoPkg.toml, since pluggable E2E tests become available in v1.14). CSI plugin authors would also be required to implement a [testdriver](https://github.com/kubernetes/kubernetes/blob/release-1.14/test/e2e/storage/testsuites/testdriver.go#L31) for their CSI plugin. The testdriver provides required functionality that would help setup testcases for a particular plugin. |
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.
Can you actually use a specific commit hash or tag in the url so that it's not possible for the line number to change?
Same for all links to line numbers
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.
@msau42 I've updated the links, can you check if they're okay now?
cd103e6
to
075dadb
Compare
book/src/functional-testing.md
Outdated
* [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl) | ||
|
||
There are two ways to run end-to-end tests for your CSI Plugin | ||
1) use [Kubernetes E2E Tests](https://github.com/kubernetes/kubernetes/tree/e84271ed8ad04c94ce3c0a6fecd9f8dff834e861/test/e2e/storage/external), by providing a DriverDefinition YAML file via a parameter. |
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.
For these higher level links where there's no specific line number referenced, I think it's fine to refer to the master for latest instructions
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.
done
2d2a898
to
fdc8de0
Compare
/lgtm Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mathu97, msau42 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 |
@msau42 does this require a release note? |
/release-note-none @jsafrane is there a way we can turn off the bot for just this repo? |
@msau42, prow config allows us to either include whole kubernetes-csi or list individual repos under kubernetes-csi. AFAIK there is no option for include whole kubernetes-csi except single repo. I wanted to avoid listing of all repos there. |
No description provided.