testsuites

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVolumeName = "test-volume-1"
	DefaultMountPath  = "/mnt/default-mount"

	DefaultIopsIoVolumes = "100"

	DefaultSizeIncreaseGi = int32(1)

	DefaultModificationTimeout   = 3 * time.Minute
	DefaultResizeTimout          = 1 * time.Minute
	DefaultK8sApiPollingInterval = 5 * time.Second

	AnnotationIops       = "ebs.csi.aws.com/iops"
	AnnotationThroughput = "ebs.csi.aws.com/throughput"
	AnnotationVolumeType = "ebs.csi.aws.com/volumeType"
)
View Source
const (
	VolumeSnapshotKind        = "VolumeSnapshot"
	VolumeSnapshotContentKind = "VolumeSnapshotContent"
	SnapshotAPIVersion        = "snapshot.storage.k8s.io/v1"
	APIVersionv1              = "v1"
)

Variables

View Source
var DefaultGeneratedVolumeMount = VolumeMountDetails{
	NameGenerate:      "test-volume-",
	MountPathGenerate: "/mnt/test-",
}
View Source
var (
	SnapshotAPIGroup = "snapshot.storage.k8s.io"
)

Functions

func AnnotatePvc added in v1.26.0

func AnnotatePvc(pvc *v1.PersistentVolumeClaim, annotations map[string]string)

AnnotatePvc annotates supplied k8s pvc object with supplied annotations

func CheckPvAnnotations added in v1.26.0

func CheckPvAnnotations(pv *v1.PersistentVolume, annotations map[string]string) bool

CheckPvAnnotations checks whether supplied k8s pv object contains supplied annotations

func IncreasePvcObjectStorage added in v1.26.0

func IncreasePvcObjectStorage(pvc *v1.PersistentVolumeClaim, sizeIncreaseGi int32) resource.Quantity

IncreasePvcObjectStorage increases `storage` of a K8s PVC object by specified Gigabytes

func PodCmdContinuousWrite added in v1.26.0

func PodCmdContinuousWrite(volumeMountPath string) string

PodCmdContinuousWrite returns pod command that would continuously write to mounted volume

func PodCmdGrepVolumeData added in v1.26.0

func PodCmdGrepVolumeData(volumeMountPath string) string

PodCmdGrepVolumeData returns pod command that would check that a volume was written to by PodCmdWriteToVolume

func PodCmdWriteToVolume added in v1.24.0

func PodCmdWriteToVolume(volumeMountPath string) string

PodCmdWriteToVolume returns pod command that would write to mounted volume

func ResizeTestPvc added in v1.24.0

func ResizeTestPvc(client clientset.Interface, namespace *v1.Namespace, testPvc *TestPersistentVolumeClaim, sizeIncreaseGi int32) (updatedSize resource.Quantity)

ResizeTestPvc increases size of given `TestPersistentVolumeClaim` by specified Gigabytes

func WaitForPvToModify added in v1.26.0

func WaitForPvToModify(c clientset.Interface, ns *v1.Namespace, pvName string, expectedAnnotations map[string]string, timeout time.Duration, interval time.Duration) error

WaitForPvToModify waiting for PV to be modified

func WaitForPvToResize added in v0.9.0

func WaitForPvToResize(c clientset.Interface, ns *v1.Namespace, pvName string, desiredSize resource.Quantity, timeout time.Duration, interval time.Duration) error

WaitForPvToResize waiting for pvc size to be resized to desired size

func WaitForVacToApplyToPv added in v1.29.0

func WaitForVacToApplyToPv(c clientset.Interface, ns *v1.Namespace, pvName string, expectedVac string, timeout time.Duration, interval time.Duration) error

WaitForVacToApplyToPv waits for a PV's VAC to match the PVC's VAC

Types

type DataSource added in v0.3.0

type DataSource struct {
	Name string
}

type DynamicallyProvisionedCmdVolumeTest added in v0.3.0

type DynamicallyProvisionedCmdVolumeTest struct {
	CSIDriver    driver.DynamicPVTestDriver
	Pods         []PodDetails
	ValidateFunc func()
}

DynamicallyProvisionedCmdVolumeTest will provision required StorageClass(es), PVC(s) and Pod(s) Waiting for the PV provisioner to create a new PV Testing if the Pod(s) Cmd is run with a 0 exit code

func (*DynamicallyProvisionedCmdVolumeTest) Run added in v0.3.0

type DynamicallyProvisionedCollocatedPodTest

type DynamicallyProvisionedCollocatedPodTest struct {
	CSIDriver    driver.DynamicPVTestDriver
	Pods         []PodDetails
	ColocatePods bool
}

DynamicallyProvisionedCollocatedPodTest will provision required StorageClass(es), PVC(s) and Pod(s) Waiting for the PV provisioner to create a new PV Testing if multiple Pod(s) can write simultaneously

func (*DynamicallyProvisionedCollocatedPodTest) Run

type DynamicallyProvisionedDeletePodTest

type DynamicallyProvisionedDeletePodTest struct {
	CSIDriver driver.DynamicPVTestDriver
	Pod       PodDetails
	PodCheck  *PodExecCheck
}

DynamicallyProvisionedDeletePodTest will provision required StorageClass and Deployment Testing if the Pod can write and read to mounted volumes Deleting a pod, and again testing if the Pod can write and read to mounted volumes

func (*DynamicallyProvisionedDeletePodTest) Run

type DynamicallyProvisionedMultiAttachTest added in v1.25.0

type DynamicallyProvisionedMultiAttachTest struct {
	CSIDriver  driver.DynamicPVTestDriver
	Pods       []PodDetails
	VolumeMode VolumeMode
	AccessMode v1.PersistentVolumeAccessMode
	VolumeType string
	RunningPod bool
	PendingPVC bool
}

func (*DynamicallyProvisionedMultiAttachTest) Run added in v1.25.0

type DynamicallyProvisionedReadOnlyVolumeTest

type DynamicallyProvisionedReadOnlyVolumeTest struct {
	CSIDriver driver.DynamicPVTestDriver
	Pods      []PodDetails
}

DynamicallyProvisionedReadOnlyVolumeTest will provision required StorageClass(es), PVC(s) and Pod(s) Waiting for the PV provisioner to create a new PV Testing that the Pod(s) cannot write to the volume when mounted

func (*DynamicallyProvisionedReadOnlyVolumeTest) Run

type DynamicallyProvisionedReclaimPolicyTest

type DynamicallyProvisionedReclaimPolicyTest struct {
	CSIDriver driver.DynamicPVTestDriver
	Volumes   []VolumeDetails
	Cloud     cloud.Cloud
}

DynamicallyProvisionedReclaimPolicyTest will provision required PV(s) and PVC(s) Testing the correct behavior for different reclaimPolicies

func (*DynamicallyProvisionedReclaimPolicyTest) Run

type DynamicallyProvisionedResizeVolumeTest added in v0.9.0

type DynamicallyProvisionedResizeVolumeTest struct {
	CSIDriver driver.DynamicPVTestDriver
	Pod       PodDetails
}

DynamicallyProvisionedResizeVolumeTest will provision required StorageClass(es), PVC(s) and Pod(s) Waiting for the PV provisioner to create a new PV Update pvc storage size Waiting for new PVC and PV to be ready And finally attach pvc to the pod and wait for pod to be ready.

func (*DynamicallyProvisionedResizeVolumeTest) Run added in v0.9.0

type DynamicallyProvisionedTopologyAwareVolumeTest

type DynamicallyProvisionedTopologyAwareVolumeTest struct {
	CSIDriver driver.DynamicPVTestDriver
	Pods      []PodDetails
}

DynamicallyProvisionedTopologyAwareVolumeTest will provision required StorageClass(es), PVC(s) and Pod(s) Waiting for the PV provisioner to create a new PV Testing if the Pod(s) can write and read to mounted volumes Validate PVs have expected PV nodeAffinity

func (*DynamicallyProvisionedTopologyAwareVolumeTest) Run

type DynamicallyProvisionedVolumeSnapshotTest added in v0.3.0

type DynamicallyProvisionedVolumeSnapshotTest struct {
	CSIDriver    driver.PVTestDriver
	Pod          PodDetails
	RestoredPod  PodDetails
	Parameters   map[string]string
	ValidateFunc func(*volumesnapshotv1.VolumeSnapshot)
}

DynamicallyProvisionedVolumeSnapshotTest will provision required StorageClass(es),VolumeSnapshotClass(es), PVC(s) and Pod(s) Waiting for the PV provisioner to create a new PV Testing if the Pod(s) can write and read to mounted volumes Create a snapshot, validate the data is still on the disk, and then write and read to it again And finally delete the snapshot This test only supports a single volume

func (*DynamicallyProvisionedVolumeSnapshotTest) Run added in v0.3.0

type FormatOptionTest added in v1.24.0

type FormatOptionTest struct {
	CreateVolumeParameters map[string]string
}

FormatOptionTest will provision required StorageClass(es), PVC(s) and Pod(s) in order to test that volumes with a specified custom format options will mount and are able to be later resized.

func (*FormatOptionTest) Run added in v1.24.0

func (t *FormatOptionTest) Run(client clientset.Interface, namespace *v1.Namespace, ebsDriver driver.PVTestDriver)

type ModifyTestType added in v1.29.0

type ModifyTestType int64
const (
	VolumeModifierForK8s ModifyTestType = iota
	ExternalResizer
)

type ModifyVolumeTest added in v1.26.0

type ModifyVolumeTest struct {
	CreateVolumeParameters                map[string]string
	ModifyVolumeAnnotations               map[string]string
	ShouldResizeVolume                    bool
	ShouldTestInvalidModificationRecovery bool
}

ModifyVolumeTest will provision pod with attached volume, and test that modifying its pvc will modify the associated pv.

func (*ModifyVolumeTest) Run added in v1.26.0

func (modifyVolumeTest *ModifyVolumeTest) Run(c clientset.Interface, ns *v1.Namespace, ebsDriver driver.PVTestDriver, testType ModifyTestType)

type PodDetails

type PodDetails struct {
	Cmd     string
	Volumes []VolumeDetails
}

func (*PodDetails) SetupDeployment

func (pod *PodDetails) SetupDeployment(client clientset.Interface, namespace *v1.Namespace, csiDriver driver.DynamicPVTestDriver) (*TestDeployment, []func())

func (*PodDetails) SetupWithDynamicVolumes

func (pod *PodDetails) SetupWithDynamicVolumes(client clientset.Interface, namespace *v1.Namespace, csiDriver driver.DynamicPVTestDriver) (*TestPod, []func())

func (*PodDetails) SetupWithPreProvisionedVolumes

func (pod *PodDetails) SetupWithPreProvisionedVolumes(client clientset.Interface, namespace *v1.Namespace, csiDriver driver.PreProvisionedVolumeTestDriver) (*TestPod, []func())

type PodExecCheck

type PodExecCheck struct {
	Cmd            []string
	ExpectedString string
}

type PreProvisionedReadOnlyVolumeTest

type PreProvisionedReadOnlyVolumeTest struct {
	CSIDriver driver.PreProvisionedVolumeTestDriver
	Pods      []PodDetails
}

PreProvisionedReadOnlyVolumeTest will provision required PV(s), PVC(s) and Pod(s) Testing that the Pod(s) cannot write to the volume when mounted

func (*PreProvisionedReadOnlyVolumeTest) Run

type PreProvisionedReclaimPolicyTest

type PreProvisionedReclaimPolicyTest struct {
	CSIDriver driver.PreProvisionedVolumeTestDriver
	Volumes   []VolumeDetails
}

PreProvisionedReclaimPolicyTest will provision required PV(s) and PVC(s) Testing the correct behavior for different reclaimPolicies

func (*PreProvisionedReclaimPolicyTest) Run

func (t *PreProvisionedReclaimPolicyTest) Run(client clientset.Interface, namespace *v1.Namespace)

type PreProvisionedVolumeSnapshotTest added in v0.9.0

type PreProvisionedVolumeSnapshotTest struct {
	CSIDriver driver.PVTestDriver
	Pod       PodDetails
}

func (*PreProvisionedVolumeSnapshotTest) Run added in v0.9.0

func (t *PreProvisionedVolumeSnapshotTest) Run(client clientset.Interface, restclient k8srestclient.Interface, namespace *v1.Namespace, snapshotId string)

type PreProvisionedVolumeTest

type PreProvisionedVolumeTest struct {
	CSIDriver driver.PreProvisionedVolumeTestDriver
	Pods      []PodDetails
}

PreProvisionedVolumeTest will provision required PV(s), PVC(s) and Pod(s) Testing if the Pod(s) can write and read to mounted volumes

func (*PreProvisionedVolumeTest) Run

func (t *PreProvisionedVolumeTest) Run(client clientset.Interface, namespace *v1.Namespace)

type StaticallyProvisionedMultiAttachTest added in v1.25.0

type StaticallyProvisionedMultiAttachTest struct {
	CSIDriver  driver.PreProvisionedVolumeTestDriver
	Pods       []PodDetails
	AccessMode v1.PersistentVolumeAccessMode
	VolumeMode v1.PersistentVolumeMode
	VolumeType string
	RunningPod bool
	PendingPVC bool
	VolumeID   string
}

func (*StaticallyProvisionedMultiAttachTest) Run added in v1.25.0

type TestDeployment

type TestDeployment struct {
	// contains filtered or unexported fields
}

func NewTestDeployment

func NewTestDeployment(c clientset.Interface, ns *v1.Namespace, command string, pvc *v1.PersistentVolumeClaim, volumeName, mountPath string, readOnly bool) *TestDeployment

func (*TestDeployment) Cleanup

func (t *TestDeployment) Cleanup()

func (*TestDeployment) Create

func (t *TestDeployment) Create()

func (*TestDeployment) DeletePodAndWait

func (t *TestDeployment) DeletePodAndWait()

func (*TestDeployment) Exec

func (t *TestDeployment) Exec(command []string, expectedString string)

func (*TestDeployment) Logs

func (t *TestDeployment) Logs() ([]byte, error)

func (*TestDeployment) WaitForPodReady

func (t *TestDeployment) WaitForPodReady()

type TestPersistentVolumeClaim

type TestPersistentVolumeClaim struct {
	// contains filtered or unexported fields
}

func NewTestPersistentVolumeClaim

func NewTestPersistentVolumeClaim(c clientset.Interface, ns *v1.Namespace, claimSize string, volumeMode VolumeMode, sc *storagev1.StorageClass, accessMode v1.PersistentVolumeAccessMode) *TestPersistentVolumeClaim

func NewTestPersistentVolumeClaimWithDataSource added in v0.3.0

func NewTestPersistentVolumeClaimWithDataSource(c clientset.Interface, ns *v1.Namespace, claimSize string, volumeMode VolumeMode, sc *storagev1.StorageClass, dataSource *v1.TypedLocalObjectReference, accessMode v1.PersistentVolumeAccessMode) *TestPersistentVolumeClaim

func (*TestPersistentVolumeClaim) Cleanup

func (t *TestPersistentVolumeClaim) Cleanup()

func (*TestPersistentVolumeClaim) Create

func (t *TestPersistentVolumeClaim) Create()

func (*TestPersistentVolumeClaim) DeleteBackingVolume

func (t *TestPersistentVolumeClaim) DeleteBackingVolume(cloud awscloud.Cloud)

func (*TestPersistentVolumeClaim) DeleteBoundPersistentVolume

func (t *TestPersistentVolumeClaim) DeleteBoundPersistentVolume()

func (*TestPersistentVolumeClaim) ReclaimPolicy

func (*TestPersistentVolumeClaim) ValidateProvisionedPersistentVolume

func (t *TestPersistentVolumeClaim) ValidateProvisionedPersistentVolume()

func (*TestPersistentVolumeClaim) WaitForBound

func (*TestPersistentVolumeClaim) WaitForPersistentVolumePhase

func (t *TestPersistentVolumeClaim) WaitForPersistentVolumePhase(phase v1.PersistentVolumePhase)

type TestPod

type TestPod struct {
	// contains filtered or unexported fields
}

func NewTestPod

func NewTestPod(c clientset.Interface, ns *v1.Namespace, command string) *TestPod

func (*TestPod) Cleanup

func (t *TestPod) Cleanup()

func (*TestPod) Create

func (t *TestPod) Create()

func (*TestPod) Logs

func (t *TestPod) Logs() ([]byte, error)

func (*TestPod) SetNodeSelector

func (t *TestPod) SetNodeSelector(nodeSelector map[string]string)

func (*TestPod) SetupRawBlockVolume added in v0.3.0

func (t *TestPod) SetupRawBlockVolume(pvc *v1.PersistentVolumeClaim, name, devicePath string)

func (*TestPod) SetupVolume

func (t *TestPod) SetupVolume(pvc *v1.PersistentVolumeClaim, name, mountPath string, readOnly bool)

func (*TestPod) WaitForFailure

func (t *TestPod) WaitForFailure()

func (*TestPod) WaitForRunning

func (t *TestPod) WaitForRunning()

func (*TestPod) WaitForSuccess

func (t *TestPod) WaitForSuccess()

type TestPreProvisionedPersistentVolume

type TestPreProvisionedPersistentVolume struct {
	// contains filtered or unexported fields
}

func (*TestPreProvisionedPersistentVolume) Create

type TestStorageClass

type TestStorageClass struct {
	// contains filtered or unexported fields
}

func (*TestStorageClass) Cleanup

func (t *TestStorageClass) Cleanup()

func (*TestStorageClass) Create

type TestVolumeSnapshotClass added in v0.3.0

type TestVolumeSnapshotClass struct {
	// contains filtered or unexported fields
}

func CreateVolumeSnapshotClass added in v0.3.0

func CreateVolumeSnapshotClass(client restclientset.Interface, namespace *v1.Namespace, csiDriver driver.VolumeSnapshotTestDriver, vscParameters map[string]string) (*TestVolumeSnapshotClass, func())

func (*TestVolumeSnapshotClass) Cleanup added in v0.3.0

func (t *TestVolumeSnapshotClass) Cleanup()

func (*TestVolumeSnapshotClass) Create added in v0.3.0

func (t *TestVolumeSnapshotClass) Create()

func (*TestVolumeSnapshotClass) CreateSnapshot added in v0.3.0

func (*TestVolumeSnapshotClass) CreateStaticVolumeSnapshot added in v0.9.0

func (*TestVolumeSnapshotClass) CreateStaticVolumeSnapshotContent added in v0.9.0

func (t *TestVolumeSnapshotClass) CreateStaticVolumeSnapshotContent(snapshotId string) *volumesnapshotv1.VolumeSnapshotContent

func (*TestVolumeSnapshotClass) DeleteSnapshot added in v0.3.0

func (*TestVolumeSnapshotClass) DeleteVolumeSnapshotContent added in v0.9.0

func (t *TestVolumeSnapshotClass) DeleteVolumeSnapshotContent(vsc *volumesnapshotv1.VolumeSnapshotContent)

func (*TestVolumeSnapshotClass) ReadyToUse added in v0.3.0

func (t *TestVolumeSnapshotClass) ReadyToUse(snapshot *volumesnapshotv1.VolumeSnapshot)

func (*TestVolumeSnapshotClass) UpdateStaticVolumeSnapshotContent added in v0.9.0

func (t *TestVolumeSnapshotClass) UpdateStaticVolumeSnapshotContent(volumeSnapshot *volumesnapshotv1.VolumeSnapshot, volumeSnapshotContent *volumesnapshotv1.VolumeSnapshotContent)

type VolumeDetails

type VolumeDetails struct {
	MountOptions               []string
	ClaimSize                  string
	ReclaimPolicy              *v1.PersistentVolumeReclaimPolicy
	AllowVolumeExpansion       *bool
	VolumeBindingMode          *storagev1.VolumeBindingMode
	AccessMode                 v1.PersistentVolumeAccessMode
	AllowedTopologyValues      []string
	VolumeMode                 VolumeMode
	VolumeMount                VolumeMountDetails
	VolumeDevice               VolumeDeviceDetails
	CreateVolumeParameters     map[string]string // Optional, used when dynamically-provisioned volumes
	VolumeID                   string            // Optional, used with pre-provisioned volumes
	PreProvisionedVolumeFsType string            // Optional, used with pre-provisioned volumes
	DataSource                 *DataSource       // Optional, used with PVCs created from snapshots
}

func CreateVolumeDetails added in v1.26.0

func CreateVolumeDetails(createVolumeParameters map[string]string, volumeSize string) *VolumeDetails

func (*VolumeDetails) SetupDynamicPersistentVolumeClaim

func (volume *VolumeDetails) SetupDynamicPersistentVolumeClaim(client clientset.Interface, namespace *v1.Namespace, csiDriver driver.DynamicPVTestDriver) (*TestPersistentVolumeClaim, []func())

func (*VolumeDetails) SetupPreProvisionedPersistentVolumeClaim

func (volume *VolumeDetails) SetupPreProvisionedPersistentVolumeClaim(client clientset.Interface, namespace *v1.Namespace, csiDriver driver.PreProvisionedVolumeTestDriver) (*TestPersistentVolumeClaim, []func())

type VolumeDeviceDetails added in v0.3.0

type VolumeDeviceDetails struct {
	NameGenerate string
	DevicePath   string
}

type VolumeMode added in v0.3.0

type VolumeMode int
const (
	FileSystem VolumeMode = iota
	Block
)

type VolumeMountDetails

type VolumeMountDetails struct {
	NameGenerate      string
	MountPathGenerate string
	ReadOnly          bool
}

Jump to

Keyboard shortcuts

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