...
1When a test suite like test/e2e/e2e.test from Kubernetes includes this
2package, the `-storage.testdriver` parameter can be used one or more
3times to enabling testing of a certain pre-installed storage driver.
4
5The parameter takes as argument the name of a .yaml or .json file. The
6filename can be absolute or relative to `--repo-root`. The content of
7the file is used to populate a struct that defines how to test the
8driver. For a full definition of the content see:
9- `struct driverDefinition` in [external.go](./external.go)
10- `struct TestDriver` and the `Cap` capability constants in [testdriver.go](../framework/testdriver.go)
11
12Here is a minimal example for the CSI hostpath driver:
13
14 StorageClass:
15 FromName: true
16 SnapshotClass:
17 FromName: true
18 DriverInfo:
19 Name: hostpath.csi.k8s.io
20 Capabilities:
21 persistence: true
22
23The `prow.sh` script of the different CSI hostpath driver releases
24generates the actual definition that is used during CI testing, for
25example in
26[v1.2.0](https://github.com/kubernetes-csi/csi-driver-host-path/blob/v1.2.0/release-tools/prow.sh#L748-L763).
27
28Currently there is no checking for unknown fields, i.e. only file
29entries that match with struct entries are used and other entries are
30silently ignored, so beware of typos.
31
32For each driver, the storage tests from `test/e2e/storage/testsuites`
33are added for that driver with `External Storage [Driver: <Name>]` as
34prefix.
35
36To run just those tests for the example above, put that content into
37`/tmp/hostpath-testdriver.yaml`, ensure `e2e.test` is in your PATH or current directory (downloaded from a test tarball like https://dl.k8s.io/release/v1.14.0/kubernetes-test-linux-amd64.tar.gz or built via `make WHAT=test/e2e/e2e.test`), and invoke:
38
39 ginkgo -p -focus='External.Storage.*hostpath.csi.k8s.io' \
40 -skip='\[Feature:|\[Disruptive\]' \
41 e2e.test \
42 -- \
43 -storage.testdriver=/tmp/hostpath-testdriver.yaml
44
45This disables tests which depend on optional features. Those tests
46must be run by selecting them explicitly in an environment that
47supports them, for example snapshotting:
48
49 ginkgo -p -focus='External.Storage.*hostpath.csi.k8s.io.*\[Feature:VolumeSnapshotDataSource\]' \
50 -skip='\[Disruptive\]' \
51 e2e.test \
52 -- \
53 -storage.testdriver=/tmp/hostpath-testdriver.yaml
View as plain text