Documentation

Index

Constants

This section is empty.

Variables

BaseSuites is a list of storage test suites that work for in-tree and CSI drivers

CSISuites is a list of storage test suites that work only for CSI drivers

Functions

func CSIInlineVolumesEnabled

func CSIInlineVolumesEnabled(c clientset.Interface, t *framework.TimeoutContext, ns string) (bool, error)

CSIInlineVolumesEnabled checks whether the running cluster has the CSIInlineVolumes feature gate enabled. It does that by trying to create a pod that uses that feature.

func ExpandPVCSize

ExpandPVCSize expands PVC size

func GenericEphemeralVolumesEnabled

func GenericEphemeralVolumesEnabled(c clientset.Interface, t *framework.TimeoutContext, ns string) (bool, error)

GenericEphemeralVolumesEnabled checks whether the running cluster has the GenericEphemeralVolume feature gate enabled. It does that by trying to create a pod that uses that feature.

func InitCapacityTestSuite

func InitCapacityTestSuite() storageframework.TestSuite

InitCapacityTestSuite returns capacityTestSuite that implements TestSuite interface\ using test suite default patterns

func InitCustomCapacityTestSuite

func InitCustomCapacityTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomCapacityTestSuite returns capacityTestSuite that implements TestSuite interface using custom test patterns

func InitCustomDisruptiveTestSuite

func InitCustomDisruptiveTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomDisruptiveTestSuite returns subPathTestSuite that implements TestSuite interface using custom test patterns

func InitCustomEphemeralTestSuite

func InitCustomEphemeralTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomEphemeralTestSuite returns ephemeralTestSuite that implements TestSuite interface using custom test patterns

func InitCustomFsGroupChangePolicyTestSuite

func InitCustomFsGroupChangePolicyTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomFsGroupChangePolicyTestSuite returns fsGroupChangePolicyTestSuite that implements TestSuite interface

func InitCustomMultiVolumeTestSuite

func InitCustomMultiVolumeTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomMultiVolumeTestSuite returns multiVolumeTestSuite that implements TestSuite interface using custom test patterns

func InitCustomProvisioningTestSuite

func InitCustomProvisioningTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomProvisioningTestSuite returns provisioningTestSuite that implements TestSuite interface using custom test patterns

func InitCustomSnapshottableStressTestSuite

func InitCustomSnapshottableStressTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomSnapshottableStressTestSuite returns snapshottableStressTestSuite that implements TestSuite interface using custom test patterns

func InitCustomSnapshottableTestSuite

func InitCustomSnapshottableTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomSnapshottableTestSuite returns snapshottableTestSuite that implements TestSuite interface using custom test patterns

func InitCustomSubPathTestSuite

func InitCustomSubPathTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomSubPathTestSuite returns subPathTestSuite that implements TestSuite interface using custom test patterns

func InitCustomTopologyTestSuite

func InitCustomTopologyTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomTopologyTestSuite returns topologyTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeExpandTestSuite

func InitCustomVolumeExpandTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomVolumeExpandTestSuite returns volumeExpandTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeIOTestSuite

func InitCustomVolumeIOTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomVolumeIOTestSuite returns volumeIOTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeLimitsTestSuite

func InitCustomVolumeLimitsTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomVolumeLimitsTestSuite returns volumeLimitsTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeModeTestSuite

func InitCustomVolumeModeTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomVolumeModeTestSuite returns volumeModeTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeStressTestSuite

func InitCustomVolumeStressTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomVolumeStressTestSuite returns volumeStressTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumesTestSuite

func InitCustomVolumesTestSuite(patterns []storageframework.TestPattern) storageframework.TestSuite

InitCustomVolumesTestSuite returns volumesTestSuite that implements TestSuite interface using custom test patterns

func InitDisruptiveTestSuite

func InitDisruptiveTestSuite() storageframework.TestSuite

InitDisruptiveTestSuite returns subPathTestSuite that implements TestSuite interface using test suite default patterns

func InitEphemeralTestSuite

func InitEphemeralTestSuite() storageframework.TestSuite

InitEphemeralTestSuite returns ephemeralTestSuite that implements TestSuite interface using test suite default patterns

func InitFsGroupChangePolicyTestSuite

func InitFsGroupChangePolicyTestSuite() storageframework.TestSuite

InitFsGroupChangePolicyTestSuite returns fsGroupChangePolicyTestSuite that implements TestSuite interface

func InitMultiVolumeTestSuite

func InitMultiVolumeTestSuite() storageframework.TestSuite

InitMultiVolumeTestSuite returns multiVolumeTestSuite that implements TestSuite interface using test suite default patterns

func InitProvisioningTestSuite

func InitProvisioningTestSuite() storageframework.TestSuite

InitProvisioningTestSuite returns provisioningTestSuite that implements TestSuite interface\ using test suite default patterns

func InitSnapshottableStressTestSuite

func InitSnapshottableStressTestSuite() storageframework.TestSuite

InitSnapshottableStressTestSuite returns snapshottableStressTestSuite that implements TestSuite interface using testsuite default patterns

func InitSnapshottableTestSuite

func InitSnapshottableTestSuite() storageframework.TestSuite

InitSnapshottableTestSuite returns snapshottableTestSuite that implements TestSuite interface using testsuite default patterns

func InitSubPathTestSuite

func InitSubPathTestSuite() storageframework.TestSuite

InitSubPathTestSuite returns subPathTestSuite that implements TestSuite interface using testsuite default patterns

func InitTopologyTestSuite

func InitTopologyTestSuite() storageframework.TestSuite

InitTopologyTestSuite returns topologyTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumeExpandTestSuite

func InitVolumeExpandTestSuite() storageframework.TestSuite

InitVolumeExpandTestSuite returns volumeExpandTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumeIOTestSuite

func InitVolumeIOTestSuite() storageframework.TestSuite

InitVolumeIOTestSuite returns volumeIOTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumeLimitsTestSuite

func InitVolumeLimitsTestSuite() storageframework.TestSuite

InitVolumeLimitsTestSuite returns volumeLimitsTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumeModeTestSuite

func InitVolumeModeTestSuite() storageframework.TestSuite

InitVolumeModeTestSuite returns volumeModeTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumePerformanceTestSuite

func InitVolumePerformanceTestSuite() storageframework.TestSuite

InitVolumePerformanceTestSuite returns volumePerformanceTestSuite that implements TestSuite interface

func InitVolumeStressTestSuite

func InitVolumeStressTestSuite() storageframework.TestSuite

InitVolumeStressTestSuite returns volumeStressTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumesTestSuite

func InitVolumesTestSuite() storageframework.TestSuite

InitVolumesTestSuite returns volumesTestSuite that implements TestSuite interface using testsuite default patterns

func MatchCapacities

func MatchCapacities(match types.GomegaMatcher) types.GomegaMatcher

MatchCapacities runs some kind of check against *storagev1beta1.CSIStorageCapacityList. In case of failure, all actual objects are appended to the failure message.

func PVMultiNodeCheck

func PVMultiNodeCheck(client clientset.Interface, timeouts *framework.TimeoutContext, claim *v1.PersistentVolumeClaim, node e2epod.NodeSelection)

PVMultiNodeCheck checks that a PV retains data when moved between nodes.

It starts these pods: - The first pod writes 'hello word' to the /mnt/test (= the volume) on one node. - The second pod runs grep 'hello world' on /mnt/test on another node.

The first node is selected by Kubernetes when scheduling the first pod. The second pod uses the same criteria, except that a special anti-affinity for the first node gets added. This test can only pass if the cluster has more than one suitable node. The caller has to ensure that.

If all succeeds, Kubernetes actually allocated something that is persistent across pods and across nodes.

This is a common test that can be called from a StorageClassTest.PvCheck.

func PVWriteReadSingleNodeCheck

func PVWriteReadSingleNodeCheck(client clientset.Interface, timeouts *framework.TimeoutContext, claim *v1.PersistentVolumeClaim, node e2epod.NodeSelection) *v1.PersistentVolume

PVWriteReadSingleNodeCheck checks that a PV retains data on a single node and returns the PV.

It starts two pods: - The first pod writes 'hello word' to the /mnt/test (= the volume) on one node. - The second pod runs grep 'hello world' on /mnt/test on the same node.

The node is selected by Kubernetes when scheduling the first pod. It's then selected via its name for the second pod.

If both succeed, Kubernetes actually allocated something that is persistent across pods.

This is a common test that can be called from a StorageClassTest.PvCheck.

func RunInPodWithVolume

func RunInPodWithVolume(c clientset.Interface, t *framework.TimeoutContext, ns, claimName, podName, command string, node e2epod.NodeSelection) *v1.Pod

RunInPodWithVolume runs a command in a pod with given claim mounted to /mnt directory. It starts, checks, collects output and stops it.

func SetupStorageClass

func SetupStorageClass(
	client clientset.Interface,
	class *storagev1.StorageClass,
) (*storagev1.StorageClass, func())

SetupStorageClass ensures that a StorageClass from a spec exists, if the StorageClass already exists then it's returned as it is, if it doesn't exist then it's created first and then returned, if the spec is nil then we return the `default` StorageClass

func StartInPodWithInlineVolume

func StartInPodWithInlineVolume(c clientset.Interface, ns, podName, command string, volumes []v1.VolumeSource, readOnly bool, node e2epod.NodeSelection) *v1.Pod

StartInPodWithInlineVolume starts a command in a pod with given volume(s) mounted to /mnt/test-<number> directory. The caller is responsible for checking the pod and deleting it.

func StartInPodWithVolume

func StartInPodWithVolume(c clientset.Interface, ns, claimName, podName, command string, node e2epod.NodeSelection) *v1.Pod

StartInPodWithVolume starts a command in a pod with given claim mounted to /mnt directory The caller is responsible for checking the pod and deleting it.

func StopPod

func StopPod(c clientset.Interface, pod *v1.Pod)

StopPod first tries to log the output of the pod's container, then deletes the pod and waits for that to succeed.

func StopPodAndDependents

func StopPodAndDependents(c clientset.Interface, timeouts *framework.TimeoutContext, pod *v1.Pod)

StopPodAndDependents first tries to log the output of the pod's container, then deletes the pod and waits for that to succeed. Also waits for all owned resources to be deleted.

func SubpathTestPod

func SubpathTestPod(f *framework.Framework, subpath, volumeType string, source *v1.VolumeSource, privilegedSecurityContext bool) *v1.Pod

SubpathTestPod returns a pod spec for subpath tests

func TestAccessMultipleVolumesAcrossPodRecreation

func TestAccessMultipleVolumesAcrossPodRecreation(f *framework.Framework, cs clientset.Interface, ns string,
	node e2epod.NodeSelection, pvcs []*v1.PersistentVolumeClaim, requiresSameNode bool)

TestAccessMultipleVolumesAcrossPodRecreation tests access to multiple volumes from single pod, then recreate pod on the same or different node depending on requiresSameNode, and recheck access to the volumes from the recreated pod

func TestBasicSubpath

func TestBasicSubpath(f *framework.Framework, contents string, pod *v1.Pod)

TestBasicSubpath runs basic subpath test

func TestBasicSubpathFile

func TestBasicSubpathFile(f *framework.Framework, contents string, pod *v1.Pod, filepath string)

TestBasicSubpathFile runs basic subpath file test

func TestConcurrentAccessToSingleVolume

func TestConcurrentAccessToSingleVolume(f *framework.Framework, cs clientset.Interface, ns string,
	node e2epod.NodeSelection, pvc *v1.PersistentVolumeClaim, numPods int, requiresSameNode bool,
	readOnly bool)

TestConcurrentAccessToSingleVolume tests access to a single volume from multiple pods, then delete the last pod, and recheck access to the volume after pod deletion to check if other pod deletion doesn't affect. Pods are deployed on the same node or different nodes depending on requiresSameNode. Read/write check are done across pod, by check reading both what pod{n-1} and pod{n} wrote from pod{n}.

func TestPodContainerRestartWithConfigmapModified

func TestPodContainerRestartWithConfigmapModified(f *framework.Framework, original, modified *v1.ConfigMap)

TestPodContainerRestartWithConfigmapModified tests that container can restart to stabilize when configmap has been modified. 1. valid container running 2. update configmap 3. container restarts 4. container becomes stable after configmap mounted file has been modified

func VolumeSourceEnabled

func VolumeSourceEnabled(c clientset.Interface, t *framework.TimeoutContext, ns string, volume v1.VolumeSource) (bool, error)

VolumeSourceEnabled checks whether a certain kind of volume source is enabled by trying to create a pod that uses it.

func WaitForControllerVolumeResize

func WaitForControllerVolumeResize(pvc *v1.PersistentVolumeClaim, c clientset.Interface, timeout time.Duration) error

WaitForControllerVolumeResize waits for the controller resize to be finished

func WaitForFSResize

WaitForFSResize waits for the filesystem in the pv to be resized

func WaitForPendingFSResizeCondition

func WaitForPendingFSResizeCondition(pvc *v1.PersistentVolumeClaim, c clientset.Interface) (*v1.PersistentVolumeClaim, error)

WaitForPendingFSResizeCondition waits for pvc to have resize condition

func WaitForResizingCondition

func WaitForResizingCondition(pvc *v1.PersistentVolumeClaim, c clientset.Interface, duration time.Duration) error

WaitForResizingCondition waits for the pvc condition to be PersistentVolumeClaimResizing

Types

type CapacityMatcher

type CapacityMatcher interface {
	types.GomegaMatcher
	// MatchedCapacities returns all CSICapacityObjects which were
	// found during the preceding Match call.
	MatchedCapacities() []storagev1beta1.CSIStorageCapacity
}

CapacityMatcher can be used to compose different matchers where one adds additional checks for CSIStorageCapacity objects already checked by another.

func HaveCapacitiesForClass

func HaveCapacitiesForClass(scName string) CapacityMatcher

HaveCapacitiesForClass filters all storage capacity objects in a *storagev1beta1.CSIStorageCapacityList by storage class. Success is when when there is at least one.

func HaveCapacitiesForClassAndNodes

func HaveCapacitiesForClassAndNodes(client kubernetes.Interface, driverName, scName, topologyKey string) CapacityMatcher

HaveCapacitiesForClassAndNodes matches objects by storage class name. It finds all nodes on which the driver runs and expects one object per node.

type EphemeralTest

type EphemeralTest struct {
	Client     clientset.Interface
	Timeouts   *framework.TimeoutContext
	Namespace  string
	DriverName string
	VolSource  *v1.VolumeSource
	Node       e2epod.NodeSelection

	// GetVolume returns the volume attributes for a
	// certain inline ephemeral volume, enumerated starting with
	// #0. Some tests might require more than one volume. They can
	// all be the same or different, depending what the driver supports
	// and/or wants to test.
	//
	// For each volume, the test driver can specify the
	// attributes, whether two pods using those attributes will
	// end up sharing the same backend storage (i.e. changes made
	// in one pod will be visible in the other), and whether
	// the volume can be mounted read/write or only read-only.
	GetVolume func(volumeNumber int) (attributes map[string]string, shared bool, readOnly bool)

	// RunningPodCheck is invoked while a pod using an inline volume is running.
	// It can execute additional checks on the pod and its volume(s). Any data
	// returned by it is passed to StoppedPodCheck.
	RunningPodCheck func(pod *v1.Pod) interface{}

	// StoppedPodCheck is invoked after ensuring that the pod is gone.
	// It is passed the data gather by RunningPodCheck or nil if that
	// isn't defined and then can do additional checks on the node,
	// like for example verifying that the ephemeral volume was really
	// removed. How to do such a check is driver-specific and not
	// covered by the generic storage test suite.
	StoppedPodCheck func(nodeName string, runningPodData interface{})

	// NumInlineVolumes sets the number of ephemeral inline volumes per pod.
	// Unset (= zero) is the same as one.
	NumInlineVolumes int

	// ReadOnly limits mounting to read-only.
	ReadOnly bool
}

EphemeralTest represents parameters to be used by tests for inline volumes. Not all parameters are used by all tests.

func (EphemeralTest) TestEphemeral

func (t EphemeralTest) TestEphemeral()

TestEphemeral tests pod creation with one ephemeral volume.

type StorageClassTest

type StorageClassTest struct {
	Client               clientset.Interface
	Timeouts             *framework.TimeoutContext
	Claim                *v1.PersistentVolumeClaim
	SourceClaim          *v1.PersistentVolumeClaim
	Class                *storagev1.StorageClass
	Name                 string
	CloudProviders       []string
	Provisioner          string
	Parameters           map[string]string
	DelayBinding         bool
	ClaimSize            string
	ExpectedSize         string
	PvCheck              func(claim *v1.PersistentVolumeClaim)
	VolumeMode           v1.PersistentVolumeMode
	AllowVolumeExpansion bool
}

StorageClassTest represents parameters to be used by provisioning tests. Not all parameters are used by all tests.

func (StorageClassTest) TestBindingWaitForFirstConsumerMultiPVC

func (t StorageClassTest) TestBindingWaitForFirstConsumerMultiPVC(claims []*v1.PersistentVolumeClaim, nodeSelector map[string]string, expectUnschedulable bool) ([]*v1.PersistentVolume, *v1.Node)

TestBindingWaitForFirstConsumerMultiPVC tests the binding with WaitForFirstConsumer mode

func (StorageClassTest) TestDynamicProvisioning

func (t StorageClassTest) TestDynamicProvisioning() *v1.PersistentVolume

TestDynamicProvisioning tests dynamic provisioning with specified StorageClassTest it's assumed that the StorageClass `t.Class` is already provisioned, see #ProvisionStorageClass