k3s/test/e2e/storage/external
Patrick Ohly 093027c891 e2e/storage: ensure that also external storage classes are unique
One previously undocumented expectation is that
GetDynamicProvisionStorageClass can be called more than once per test
and then each time returns a new, unique storage class. The in-memory
implementation in driveroperations.go:GetStorageClass ensured that,
but loading from a .yaml file didn't. This caused the multivolume tests
to fail when applied to an already installed GCE driver with the
-storage.testdriver parameter.
2019-05-09 08:53:25 +02:00
..
testdata
BUILD e2e/storage: ensure that also external storage classes are unique 2019-05-09 08:53:25 +02:00
README.md Use e2e.test instead of test/e2e in example invocations 2019-04-23 15:59:54 -04:00
external.go e2e/storage: ensure that also external storage classes are unique 2019-05-09 08:53:25 +02:00
external_test.go

README.md

When a test suite like test/e2e/e2e.test from Kubernetes includes this package, the -storage.testdriver parameter can be used one or more times to enabling testing of a certain pre-installed storage driver.

The parameter takes as argument the name of a .yaml or .json file. The filename can be absolute or relative to --repo-root. The content of the file is used to populate a struct that defines how to test the driver. For a full definition of the struct see the external.go file.

Here is an example for the CSI hostpath driver:

ShortName: mytest
StorageClass:
  FromName: true
SnapshotClass:
  FromName: true
DriverInfo:
  Name: csi-hostpath
  Capabilities:
    persistence: true
    dataSource: true
    multipods: true

Currently there is no checking for unknown fields, i.e. only file entries that match with struct entries are used and other entries are silently ignored, so beware of typos.

For each driver, the storage tests from test/e2e/storage/testsuites are added for that driver with External Storage [Driver: <Name>] as prefix.

To run just those tests for the example above, put that content into /tmp/hostpath-testdriver.yaml, ensure e2e.test is in your PATH or current directory (downloaded from a test tarball like https://storage.googleapis.com/kubernetes-release/release/v1.14.0/kubernetes-test-linux-amd64.tar.gz or built via make WHAT=test/e2e/e2e.test), and invoke:

ginkgo -p -focus='External.Storage.*csi-hostpath' \
       -skip='\[Feature:|\[Disruptive\]' \
       e2e.test \
       -- \
       -storage.testdriver=/tmp/hostpath-testdriver.yaml

This disables tests which depend on optional features. Those tests must be run by selecting them explicitly in an environment that supports them, for example snapshotting:

ginkgo -p -focus='External.Storage.*csi-hostpath.*\[Feature:VolumeSnapshotDataSource\]' \
       -skip='\[Disruptive\]' \
       e2e.test \
       -- \
       -storage.testdriver=/tmp/hostpath-testdriver.yaml