From 2d2a8988761804565478e2598e269b971388d42e Mon Sep 17 00:00:00 2001 From: Mathusan Selvarajah Date: Fri, 10 May 2019 11:33:04 -0400 Subject: [PATCH] Update functional-testing.md --- book/src/functional-testing.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/src/functional-testing.md b/book/src/functional-testing.md index 12ac2477..24dc0395 100644 --- a/book/src/functional-testing.md +++ b/book/src/functional-testing.md @@ -15,8 +15,8 @@ Currently, [csi-sanity](https://github.com/kubernetes-csi/csi-test/tree/master/c * [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. - * **Note**: In some cases you would not be able to use this method, in running e2e tests by just providing a YAML file defining your CSI plugin. For example the [NFS CSI plugin](https://github.com/kubernetes-csi/csi-driver-nfs/tree/2c5c9bcd62595bd3b7f4976539f3bf3dcf3bbbc6) currently 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. + 1) use [Kubernetes E2E Tests](https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external), by providing a DriverDefinition YAML file via a parameter. + * **Note**: In some cases you would not be able to use this method, in running e2e tests by just providing a YAML file defining your CSI plugin. For example the [NFS CSI plugin](https://github.com/kubernetes-csi/csi-driver-nfs) currently 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. 2) import the in-tree storage tests and run them using `go test`. @@ -24,7 +24,7 @@ There are two ways to run end-to-end tests for your CSI Plugin ## Importing the E2E test suite as a library -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/tree/2c5c9bcd62595bd3b7f4976539f3bf3dcf3bbbc6) is setup, where the testfiles are in a `test` directory and the main test file is in the `cmd` directory. +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 to 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/6644db9914379a4a7b3d3487b41b2010f226e4dc/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. @@ -73,7 +73,7 @@ You would define something similar for your CSI plugin. Depending on your plugin's specs, you would implement other interaces defined [here](https://github.com/kubernetes/kubernetes/blob/6644db9914379a4a7b3d3487b41b2010f226e4dc/test/e2e/storage/testsuites/testdriver.go#L61). For example the [NFS testdriver](https://github.com/kubernetes-csi/csi-driver-nfs/blob/193faa0f2aa92a3be0855764a1126ff3cdcd3e77/test/nfs-testdriver.go#L66) also implements PreprovisionedVolumeTestDriver and PreprovisionedPVTestDriver interfaces, to enable pre-provisoned tests. -After implementing the testdriver for your CSI plugin, you would create a `csi-volumes.go` file, where the implemented testdriver is used to run in-tree storage testsuites, [similar to how the NFS CSI plugin does so](https://github.com/kubernetes-csi/csi-driver-nfs/blob/193faa0f2aa92a3be0855764a1126ff3cdcd3e77/test/csi-volumes.go#L37). This is where you would define which testsuites you would want to run for your plugin. All available in-tree testsuites can be found [here](https://github.com/kubernetes/kubernetes/tree/6644db9914379a4a7b3d3487b41b2010f226e4dc/test/e2e/storage/testsuites). +After implementing the testdriver for your CSI plugin, you would create a `csi-volumes.go` file, where the implemented testdriver is used to run in-tree storage testsuites, [similar to how the NFS CSI plugin does so](https://github.com/kubernetes-csi/csi-driver-nfs/blob/193faa0f2aa92a3be0855764a1126ff3cdcd3e77/test/csi-volumes.go#L37). This is where you would define which testsuites you would want to run for your plugin. All available in-tree testsuites can be found [here](https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/testsuites). Finally, importing the `test` package into your [main test file](https://github.com/kubernetes-csi/csi-driver-nfs/blob/193faa0f2aa92a3be0855764a1126ff3cdcd3e77/cmd/tests/nfs-e2e.go#L18) will [initialize the testsuites to run the E2E tests](https://github.com/kubernetes-csi/csi-driver-nfs/blob/193faa0f2aa92a3be0855764a1126ff3cdcd3e77/test/csi-volumes.go#L37).