testsuites

package
v1.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 55 Imported by: 30

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 AllEphemeralTestPatterns added in v1.23.0

func AllEphemeralTestPatterns() []storageframework.TestPattern

AllEphemeralTestPatterns returns all pre-defined test patterns for generic and CSI ephemeral inline volumes.

func CSIEphemeralTestPatterns added in v1.23.0

func CSIEphemeralTestPatterns() []storageframework.TestPattern

CSIEphemeralTestPatterns returns the test patterns for CSI ephemeral inline volumes.

func CSIInlineVolumesEnabled added in v1.16.0

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 added in v1.16.0

ExpandPVCSize expands PVC size

func GenericEphemeralTestPatterns added in v1.23.0

func GenericEphemeralTestPatterns() []storageframework.TestPattern

GenericEphemeralTestPatterns returns the test patterns for generic ephemeral inline volumes.

func GenericEphemeralVolumesEnabled added in v1.19.0

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 added in v1.21.0

func InitCapacityTestSuite() storageframework.TestSuite

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

func InitCustomCapacityTestSuite added in v1.21.0

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

InitCustomCapacityTestSuite returns capacityTestSuite that implements TestSuite interface using custom test patterns

func InitCustomDisruptiveTestSuite added in v1.21.0

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

InitCustomDisruptiveTestSuite returns subPathTestSuite that implements TestSuite interface using custom test patterns

func InitCustomEphemeralTestSuite added in v1.21.0

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

InitCustomEphemeralTestSuite returns ephemeralTestSuite that implements TestSuite interface using custom test patterns

func InitCustomFsGroupChangePolicyTestSuite added in v1.21.0

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

InitCustomFsGroupChangePolicyTestSuite returns fsGroupChangePolicyTestSuite that implements TestSuite interface

func InitCustomMultiVolumeTestSuite added in v1.21.0

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

InitCustomMultiVolumeTestSuite returns multiVolumeTestSuite that implements TestSuite interface using custom test patterns

func InitCustomProvisioningTestSuite added in v1.21.0

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

InitCustomProvisioningTestSuite returns provisioningTestSuite that implements TestSuite interface using custom test patterns

func InitCustomSnapshottableStressTestSuite added in v1.21.0

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

InitCustomSnapshottableStressTestSuite returns snapshottableStressTestSuite that implements TestSuite interface using custom test patterns

func InitCustomSnapshottableTestSuite added in v1.21.0

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

InitCustomSnapshottableTestSuite returns snapshottableTestSuite that implements TestSuite interface using custom test patterns

func InitCustomSubPathTestSuite added in v1.21.0

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

InitCustomSubPathTestSuite returns subPathTestSuite that implements TestSuite interface using custom test patterns

func InitCustomTopologyTestSuite added in v1.21.0

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

InitCustomTopologyTestSuite returns topologyTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeExpandTestSuite added in v1.21.0

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

InitCustomVolumeExpandTestSuite returns volumeExpandTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeIOTestSuite added in v1.21.0

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

InitCustomVolumeIOTestSuite returns volumeIOTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeLimitsTestSuite added in v1.21.0

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

InitCustomVolumeLimitsTestSuite returns volumeLimitsTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeModeTestSuite added in v1.21.0

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

InitCustomVolumeModeTestSuite returns volumeModeTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumeStressTestSuite added in v1.21.0

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

InitCustomVolumeStressTestSuite returns volumeStressTestSuite that implements TestSuite interface using custom test patterns

func InitCustomVolumesTestSuite added in v1.21.0

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

InitCustomVolumesTestSuite returns volumesTestSuite that implements TestSuite interface using custom test patterns

func InitDisruptiveTestSuite added in v1.16.0

func InitDisruptiveTestSuite() storageframework.TestSuite

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

func InitEphemeralTestSuite added in v1.16.0

func InitEphemeralTestSuite() storageframework.TestSuite

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

func InitFsGroupChangePolicyTestSuite added in v1.20.0

func InitFsGroupChangePolicyTestSuite() storageframework.TestSuite

InitFsGroupChangePolicyTestSuite returns fsGroupChangePolicyTestSuite that implements TestSuite interface

func InitMultiVolumeTestSuite added in v1.15.0

func InitMultiVolumeTestSuite() storageframework.TestSuite

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

func InitProvisioningTestSuite added in v1.13.0

func InitProvisioningTestSuite() storageframework.TestSuite

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

func InitSnapshottableStressTestSuite added in v1.19.6

func InitSnapshottableStressTestSuite() storageframework.TestSuite

InitSnapshottableStressTestSuite returns snapshottableStressTestSuite that implements TestSuite interface using testsuite default patterns

func InitSnapshottableTestSuite added in v1.14.0

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 added in v1.17.0

func InitTopologyTestSuite() storageframework.TestSuite

InitTopologyTestSuite returns topologyTestSuite that implements TestSuite interface using testsuite default patterns

func InitVolumeExpandTestSuite added in v1.16.0

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 added in v1.16.0

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 added in v1.21.0

func InitVolumePerformanceTestSuite() storageframework.TestSuite

InitVolumePerformanceTestSuite returns volumePerformanceTestSuite that implements TestSuite interface

func InitVolumeStressTestSuite added in v1.19.6

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 added in v1.21.0

func MatchCapacities(match types.GomegaMatcher) types.GomegaMatcher

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

func MultiplePVMountSingleNodeCheck added in v1.24.0

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

MultiplePVMountSingleNodeCheck checks that multiple PV pointing to the same underlying storage can be mounted simultaneously on a single node.

Steps: - Start Pod1 using PVC1, PV1 (which points to a underlying volume v) on node N1. - Create PVC2, PV2 and prebind them. PV2 points to the same underlying volume v. - Start Pod2 using PVC2, PV2 (which points to a underlying volume v) on node N1.

func PVMultiNodeCheck added in v1.14.0

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 added in v1.14.0

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 added in v1.14.0

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 added in v1.21.0

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 added in v1.16.0

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 added in v1.14.0

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 StartInPodWithVolumeSource added in v1.23.0

func StartInPodWithVolumeSource(c clientset.Interface, volSrc v1.VolumeSource, ns, podName, command string, node e2epod.NodeSelection) *v1.Pod

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

func StopPod added in v1.14.0

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 added in v1.19.0

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 added in v1.15.0

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 TestConcurrentAccessToRelatedVolumes added in v1.22.0

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

TestConcurrentAccessToRelatedVolumes tests access to multiple volumes from multiple pods. Each provided PVC is used by a single pod. The test ensures that volumes created from another volume (=clone) or volume snapshot can be used together with the original volume.

func TestConcurrentAccessToSingleVolume added in v1.15.0

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 added in v1.19.0

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 added in v1.19.0

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 added in v1.16.0

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

WaitForControllerVolumeResize waits for the controller resize to be finished

func WaitForFSResize added in v1.16.0

WaitForFSResize waits for the filesystem in the pv to be resized

func WaitForPendingFSResizeCondition added in v1.18.0

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

WaitForPendingFSResizeCondition waits for pvc to have resize condition

func WaitForResizingCondition added in v1.16.0

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

WaitForResizingCondition waits for the pvc condition to be PersistentVolumeClaimResizing

Types

type CapacityMatcher added in v1.21.0

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

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

func HaveCapacitiesForClass added in v1.21.0

func HaveCapacitiesForClass(scName string) CapacityMatcher

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

func HaveCapacitiesForClassAndNodes added in v1.21.0

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 added in v1.16.0

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 added in v1.16.0

func (t EphemeralTest) TestEphemeral()

TestEphemeral tests pod creation with one ephemeral volume.

type StorageClassTest added in v1.13.0

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
	NodeSelection        e2epod.NodeSelection
}

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

func (StorageClassTest) TestBindingWaitForFirstConsumerMultiPVC added in v1.14.0

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 added in v1.14.0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL