Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertTestConfig(in *PerTestConfig) e2evolume.TestConfig
- func CopyStorageClass(sc *storagev1.StorageClass, ns string, suffix string) *storagev1.StorageClass
- func CopyVolumeAttributesClass(vac *storagev1beta1.VolumeAttributesClass, ns string, suffix string) *storagev1beta1.VolumeAttributesClass
- func CreateSnapshot(ctx context.Context, sDriver SnapshottableTestDriver, config *PerTestConfig, ...) (*unstructured.Unstructured, *unstructured.Unstructured)
- func CreateVolumeGroupSnapshot(ctx context.Context, sDriver VoulmeGroupSnapshottableTestDriver, ...) (*unstructured.Unstructured, *unstructured.Unstructured)
- func DefineTestSuites(driver TestDriver, tsInits []func() TestSuite)
- func GetDriverNameWithFeatureTags(driver TestDriver) []interface{}
- func GetDriverTimeouts(driver TestDriver) *framework.TimeoutContext
- func GetStorageClass(provisioner string, parameters map[string]string, ...) *storagev1.StorageClass
- func NewVolTypeMap(types ...TestVolType) map[TestVolType]bool
- func RegisterTests(suite TestSuite, driver TestDriver, pattern TestPattern)
- func SkipInvalidDriverPatternCombination(driver TestDriver, pattern TestPattern)
- type Capability
- type CustomTimeoutsTestDriver
- type DriverInfo
- type DynamicPVTestDriver
- type EphemeralTestDriver
- type InlineVolumeTestDriver
- type Metrics
- type PerTestConfig
- type PerformanceTestOptions
- type PerformanceTestProvisioningOptions
- type PreprovisionedPVTestDriver
- type PreprovisionedVolumeTestDriver
- type SnapshotResource
- type SnapshottableTestDriver
- type StressTestOptions
- type TestDriver
- type TestPattern
- type TestSnapshotDeletionPolicy
- type TestSnapshotType
- type TestSuite
- type TestSuiteInfo
- type TestVolType
- type TestVolume
- type VolumeAttributesClassTestDriver
- type VolumeGroupSnapshotResource
- type VolumeResource
- func CreateVolumeResource(ctx context.Context, driver TestDriver, config *PerTestConfig, ...) *VolumeResource
- func CreateVolumeResourceWithAccessModes(ctx context.Context, driver TestDriver, config *PerTestConfig, ...) *VolumeResource
- func CreateVolumeResourceWithVAC(ctx context.Context, driver TestDriver, config *PerTestConfig, ...) *VolumeResource
- type VolumeSnapshotStressTestOptions
- type VoulmeGroupSnapshottableTestDriver
Constants ¶
const ( // MinFileSize represents minimum file size (1 MiB) for testing MinFileSize = 1 * e2evolume.MiB // FileSizeSmall represents small file size (1 MiB) for testing FileSizeSmall = 1 * e2evolume.MiB // FileSizeMedium represents medium file size (100 MiB) for testing FileSizeMedium = 100 * e2evolume.MiB // FileSizeLarge represents large file size (1 GiB) for testing FileSizeLarge = 1 * e2evolume.GiB )
Variables ¶
var ( // DefaultFsInlineVolume is TestPattern for "Inline-volume (default fs)" DefaultFsInlineVolume = TestPattern{ Name: "Inline-volume (default fs)", VolType: InlineVolume, } // DefaultFsCSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (default fs)" DefaultFsCSIEphemeralVolume = TestPattern{ Name: "CSI Ephemeral-volume (default fs)", VolType: CSIInlineVolume, } // DefaultFsGenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (default fs)" DefaultFsGenericEphemeralVolume = TestPattern{ Name: "Generic Ephemeral-volume (default fs)", VolType: GenericEphemeralVolume, AllowExpansion: true, } // DefaultFsPreprovisionedPV is TestPattern for "Pre-provisioned PV (default fs)" DefaultFsPreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (default fs)", VolType: PreprovisionedPV, } // DefaultFsDynamicPV is TestPattern for "Dynamic PV (default fs)" DefaultFsDynamicPV = TestPattern{ Name: "Dynamic PV (default fs)", VolType: DynamicPV, SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, } // Ext3InlineVolume is TestPattern for "Inline-volume (ext3)" Ext3InlineVolume = TestPattern{ Name: "Inline-volume (ext3)", VolType: InlineVolume, FsType: "ext3", } // Ext3CSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (ext3)" Ext3CSIEphemeralVolume = TestPattern{ Name: "CSI Ephemeral-volume (ext3)", VolType: CSIInlineVolume, FsType: "ext3", } // Ext3GenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (ext3)" Ext3GenericEphemeralVolume = TestPattern{ Name: "Generic Ephemeral-volume (ext3)", VolType: GenericEphemeralVolume, FsType: "ext3", } // Ext3PreprovisionedPV is TestPattern for "Pre-provisioned PV (ext3)" Ext3PreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (ext3)", VolType: PreprovisionedPV, FsType: "ext3", } // Ext3DynamicPV is TestPattern for "Dynamic PV (ext3)" Ext3DynamicPV = TestPattern{ Name: "Dynamic PV (ext3)", VolType: DynamicPV, FsType: "ext3", } // Ext4InlineVolume is TestPattern for "Inline-volume (ext4)" Ext4InlineVolume = TestPattern{ Name: "Inline-volume (ext4)", VolType: InlineVolume, FsType: "ext4", } // Ext4CSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (ext4)" Ext4CSIEphemeralVolume = TestPattern{ Name: "CSI Ephemeral-volume (ext4)", VolType: CSIInlineVolume, FsType: "ext4", } // Ext4GenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (ext4)" Ext4GenericEphemeralVolume = TestPattern{ Name: "Generic Ephemeral-volume (ext4)", VolType: GenericEphemeralVolume, FsType: "ext4", } // Ext4PreprovisionedPV is TestPattern for "Pre-provisioned PV (ext4)" Ext4PreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (ext4)", VolType: PreprovisionedPV, FsType: "ext4", } // Ext4DynamicPV is TestPattern for "Dynamic PV (ext4)" Ext4DynamicPV = TestPattern{ Name: "Dynamic PV (ext4)", VolType: DynamicPV, FsType: "ext4", SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, } // XfsInlineVolume is TestPattern for "Inline-volume (xfs)" XfsInlineVolume = TestPattern{ Name: "Inline-volume (xfs)", VolType: InlineVolume, FsType: "xfs", TestTags: []interface{}{framework.WithSlow()}, } // XfsCSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (xfs)" XfsCSIEphemeralVolume = TestPattern{ Name: "CSI Ephemeral-volume (xfs)", VolType: CSIInlineVolume, FsType: "xfs", TestTags: []interface{}{framework.WithSlow()}, } // XfsGenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (xfs)" XfsGenericEphemeralVolume = TestPattern{ Name: "Generic Ephemeral-volume (xfs)", VolType: GenericEphemeralVolume, FsType: "xfs", TestTags: []interface{}{framework.WithSlow()}, } // XfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (xfs)" XfsPreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (xfs)", VolType: PreprovisionedPV, FsType: "xfs", TestTags: []interface{}{framework.WithSlow()}, } // XfsDynamicPV is TestPattern for "Dynamic PV (xfs)" XfsDynamicPV = TestPattern{ Name: "Dynamic PV (xfs)", VolType: DynamicPV, FsType: "xfs", TestTags: []interface{}{framework.WithSlow()}, SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, } // NtfsInlineVolume is TestPattern for "Inline-volume (ntfs)" NtfsInlineVolume = TestPattern{ Name: "Inline-volume (ntfs)", VolType: InlineVolume, FsType: "ntfs", TestTags: []interface{}{feature.Windows}, } // NtfsCSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (ntfs)" NtfsCSIEphemeralVolume = TestPattern{ Name: "CSI Ephemeral-volume (ntfs) [alpha]", VolType: CSIInlineVolume, FsType: "ntfs", TestTags: []interface{}{feature.Windows}, } // NtfsGenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (ntfs)" NtfsGenericEphemeralVolume = TestPattern{ Name: "Generic Ephemeral-volume (ntfs)", VolType: GenericEphemeralVolume, FsType: "ntfs", TestTags: []interface{}{feature.Windows}, } // NtfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (ntfs)" NtfsPreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (ntfs)", VolType: PreprovisionedPV, FsType: "ntfs", TestTags: []interface{}{feature.Windows}, } // NtfsDynamicPV is TestPattern for "Dynamic PV (ntfs)" NtfsDynamicPV = TestPattern{ Name: "Dynamic PV (ntfs)", VolType: DynamicPV, FsType: "ntfs", TestTags: []interface{}{feature.Windows}, SnapshotDeletionPolicy: DeleteSnapshot, SnapshotType: DynamicCreatedSnapshot, } // FsVolModePreprovisionedPV is TestPattern for "Pre-provisioned PV (filesystem)" FsVolModePreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (filesystem volmode)", VolType: PreprovisionedPV, VolMode: v1.PersistentVolumeFilesystem, } // FsVolModeDynamicPV is TestPattern for "Dynamic PV (filesystem)" FsVolModeDynamicPV = TestPattern{ Name: "Dynamic PV (filesystem volmode)", VolType: DynamicPV, VolMode: v1.PersistentVolumeFilesystem, } // BlockVolModePreprovisionedPV is TestPattern for "Pre-provisioned PV (block)" BlockVolModePreprovisionedPV = TestPattern{ Name: "Pre-provisioned PV (block volmode)", VolType: PreprovisionedPV, VolMode: v1.PersistentVolumeBlock, } // BlockVolModeDynamicPV is TestPattern for "Dynamic PV (block)" BlockVolModeDynamicPV = TestPattern{ Name: "Dynamic PV (block volmode)", VolType: DynamicPV, VolMode: v1.PersistentVolumeBlock, SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, } // BlockVolModeGenericEphemeralVolume is for generic ephemeral inline volumes in raw block mode. BlockVolModeGenericEphemeralVolume = TestPattern{ Name: "Generic Ephemeral-volume (block volmode) (late-binding)", VolType: GenericEphemeralVolume, VolMode: v1.PersistentVolumeBlock, BindingMode: storagev1.VolumeBindingWaitForFirstConsumer, AllowExpansion: true, } // DynamicSnapshotDelete is TestPattern for "Dynamic snapshot" DynamicSnapshotDelete = TestPattern{ Name: "Dynamic Snapshot (delete policy)", SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, VolType: DynamicPV, } // VolumeGroupSnapshotDelete is TestPattern for "VolumeGroupSnapshot" VolumeGroupSnapshotDelete = TestPattern{ Name: " (delete policy)", SnapshotType: VolumeGroupSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, VolType: DynamicPV, } // PreprovisionedSnapshotDelete is TestPattern for "Pre-provisioned snapshot" PreprovisionedSnapshotDelete = TestPattern{ Name: "Pre-provisioned Snapshot (delete policy)", SnapshotType: PreprovisionedCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, VolType: DynamicPV, } // EphemeralSnapshotDelete is TestPattern for snapshotting of a generic ephemeral volume // where snapshots are deleted. EphemeralSnapshotDelete = TestPattern{ Name: "Ephemeral Snapshot (delete policy)", SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: DeleteSnapshot, VolType: GenericEphemeralVolume, } // DynamicSnapshotRetain is TestPattern for "Dynamic snapshot" DynamicSnapshotRetain = TestPattern{ Name: "Dynamic Snapshot (retain policy)", SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: RetainSnapshot, VolType: DynamicPV, } // PreprovisionedSnapshotRetain is TestPattern for "Pre-provisioned snapshot" PreprovisionedSnapshotRetain = TestPattern{ Name: "Pre-provisioned Snapshot (retain policy)", SnapshotType: PreprovisionedCreatedSnapshot, SnapshotDeletionPolicy: RetainSnapshot, VolType: DynamicPV, } // EphemeralSnapshotDelete is TestPattern for snapshotting of a generic ephemeral volume // where snapshots are preserved. EphemeralSnapshotRetain = TestPattern{ Name: "Ephemeral Snapshot (retain policy)", SnapshotType: DynamicCreatedSnapshot, SnapshotDeletionPolicy: RetainSnapshot, VolType: GenericEphemeralVolume, } // DefaultFsDynamicPVAllowExpansion is TestPattern for "Dynamic PV (default fs)(allowExpansion)" DefaultFsDynamicPVAllowExpansion = TestPattern{ Name: "Dynamic PV (default fs)(allowExpansion)", VolType: DynamicPV, AllowExpansion: true, } // NtfsDynamicPVAllowExpansion is TestPattern for "Dynamic PV (default fs)(allowExpansion)" NtfsDynamicPVAllowExpansion = TestPattern{ Name: "Dynamic PV (ntfs)(allowExpansion)", VolType: DynamicPV, AllowExpansion: true, FsType: "ntfs", TestTags: []interface{}{feature.Windows}, } // BlockVolModeDynamicPVAllowExpansion is TestPattern for "Dynamic PV (block volmode)(allowExpansion)" BlockVolModeDynamicPVAllowExpansion = TestPattern{ Name: "Dynamic PV (block volmode)(allowExpansion)", VolType: DynamicPV, VolMode: v1.PersistentVolumeBlock, AllowExpansion: true, } // TopologyImmediate is TestPattern for immediate binding TopologyImmediate = TestPattern{ Name: "Dynamic PV (immediate binding)", VolType: DynamicPV, BindingMode: storagev1.VolumeBindingImmediate, } // TopologyDelayed is TestPattern for delayed binding TopologyDelayed = TestPattern{ Name: "Dynamic PV (delayed binding)", VolType: DynamicPV, BindingMode: storagev1.VolumeBindingWaitForFirstConsumer, } )
Functions ¶
func ConvertTestConfig ¶
func ConvertTestConfig(in *PerTestConfig) e2evolume.TestConfig
ConvertTestConfig returns a framework test config with the parameters specified for the testsuite or (if available) the dynamically created config for the volume server.
This is done because TestConfig is the public API for the testsuites package whereas volume.TestConfig is merely an implementation detail. It contains fields that have no effect.
func CopyStorageClass ¶
func CopyStorageClass(sc *storagev1.StorageClass, ns string, suffix string) *storagev1.StorageClass
CopyStorageClass constructs a new StorageClass instance with a unique name that is based on namespace + suffix using the same storageclass setting from the parameter
func CopyVolumeAttributesClass ¶ added in v1.31.0
func CopyVolumeAttributesClass(vac *storagev1beta1.VolumeAttributesClass, ns string, suffix string) *storagev1beta1.VolumeAttributesClass
CopyVolumeAttributesClass constructs a new VolumeAttributesClass instance with a unique name that is based on namespace + suffix using the VolumeAttributesClass passed in as a parameter
func CreateSnapshot ¶
func CreateSnapshot(ctx context.Context, sDriver SnapshottableTestDriver, config *PerTestConfig, pattern TestPattern, pvcName string, pvcNamespace string, timeouts *framework.TimeoutContext, parameters map[string]string) (*unstructured.Unstructured, *unstructured.Unstructured)
CreateSnapshot creates a VolumeSnapshotClass with given SnapshotDeletionPolicy and a VolumeSnapshot from the VolumeSnapshotClass using a dynamic client. Returns the unstructured VolumeSnapshotClass and VolumeSnapshot objects.
func CreateVolumeGroupSnapshot ¶ added in v1.32.0
func CreateVolumeGroupSnapshot(ctx context.Context, sDriver VoulmeGroupSnapshottableTestDriver, config *PerTestConfig, pattern TestPattern, groupName string, pvcNamespace string, timeouts *framework.TimeoutContext, parameters map[string]string) (*unstructured.Unstructured, *unstructured.Unstructured)
CreateVolumeGroupSnapshot creates a VolumeGroupSnapshotClass with given SnapshotDeletionPolicy and a VolumeGroupSnapshot from the VolumeGroupSnapshotClass using a dynamic client. Returns the unstructured VolumeGroupSnapshotClass and VolumeGroupSnapshot objects.
func DefineTestSuites ¶
func DefineTestSuites(driver TestDriver, tsInits []func() TestSuite)
DefineTestSuites defines tests for all testpatterns and all testSuites for a driver
func GetDriverNameWithFeatureTags ¶
func GetDriverNameWithFeatureTags(driver TestDriver) []interface{}
GetDriverNameWithFeatureTags returns parameters that can be passed to framework.Context. For example:
- [Driver: nfs]
- [Driver: rbd], feature.Volumes
func GetDriverTimeouts ¶
func GetDriverTimeouts(driver TestDriver) *framework.TimeoutContext
GetDriverTimeouts returns the timeout of the driver operation
func GetStorageClass ¶
func GetStorageClass( provisioner string, parameters map[string]string, bindingMode *storagev1.VolumeBindingMode, ns string, ) *storagev1.StorageClass
GetStorageClass constructs a new StorageClass instance with a unique name that is based on namespace + suffix.
func NewVolTypeMap ¶
func NewVolTypeMap(types ...TestVolType) map[TestVolType]bool
NewVolTypeMap creates a map with the given TestVolTypes enabled
func RegisterTests ¶
func RegisterTests(suite TestSuite, driver TestDriver, pattern TestPattern)
RegisterTests register the driver + pattern combination to the inside TestSuite This function actually register tests inside testsuite
func SkipInvalidDriverPatternCombination ¶
func SkipInvalidDriverPatternCombination(driver TestDriver, pattern TestPattern)
SkipInvalidDriverPatternCombination will skip tests if the combination of driver, and testpattern is not compatible to be tested. This function will be called in the RegisterTests() to make sure all the testsuites we defined are valid.
Whether it needs to be skipped is checked by following steps: 0. Check with driver SkipUnsupportedTest 1. Check if volType is supported by driver from its interface 2. Check if fsType is supported
Test suites can also skip tests inside their own skipUnsupportedTests function or in individual tests.
Types ¶
type Capability ¶
type Capability string
Capability represents a feature that a volume plugin supports
const ( CapPersistence Capability = "persistence" // data is persisted across pod restarts CapBlock Capability = "block" // raw block mode CapFsGroup Capability = "fsGroup" // volume ownership via fsGroup CapVolumeMountGroup Capability = "volumeMountGroup" // Driver has the VolumeMountGroup CSI node capability. Because this is a FSGroup feature, the fsGroup capability must also be set to true. CapExec Capability = "exec" // exec a file in the volume CapSnapshotDataSource Capability = "snapshotDataSource" // support populate data from snapshot CapVolumeGroupSnapshot Capability = "groupSnapshot" // support group snapshot CapPVCDataSource Capability = "pvcDataSource" // support populate data from pvc // multiple pods on a node can use the same volume concurrently; // for CSI, see: // - https://github.com/container-storage-interface/spec/pull/150 // - https://github.com/container-storage-interface/spec/issues/178 // - NodeStageVolume in the spec CapMultiPODs Capability = "multipods" CapRWX Capability = "RWX" // support ReadWriteMany access modes CapControllerExpansion Capability = "controllerExpansion" // support volume expansion for controller CapNodeExpansion Capability = "nodeExpansion" // support volume expansion for node // offlineExpansion and onlineExpansion both default to true when // controllerExpansion is true. The only reason to set offlineExpansion // to false is when a CSI driver can only expand a volume while it's // attached to a pod. Conversely, onlineExpansion can be set to false // if the driver can only expand a volume while it is detached. CapOfflineExpansion Capability = "offlineExpansion" // supports offline volume expansion (default: true) CapOnlineExpansion Capability = "onlineExpansion" // supports online volume expansion (default: true) CapVolumeLimits Capability = "volumeLimits" // support volume limits (can be *very* slow) CapSingleNodeVolume Capability = "singleNodeVolume" // support volume that can run on single node (like hostpath) CapTopology Capability = "topology" // support topology // The driver publishes storage capacity information: when the storage class // for dynamic provisioning exists, the driver is expected to provide // capacity information for it. CapCapacity Capability = "capacity" // Anti-capability for drivers that do not support filesystem resizing of PVCs // that are cloned or restored from a snapshot. CapFSResizeFromSourceNotSupported Capability = "FSResizeFromSourceNotSupported" // To support ReadWriteOncePod, the following CSI sidecars must be // updated to these versions or greater: // - csi-provisioner:v3.0.0+ // - csi-attacher:v3.3.0+ // - csi-resizer:v1.3.0+ CapReadWriteOncePod Capability = "readWriteOncePod" // The driver can handle two PersistentVolumes with the same VolumeHandle (= volume_id in CSI spec). // This capability is highly recommended for volumes that support ReadWriteMany access mode, // because creating multiple PVs for the same VolumeHandle is frequently used to share a single // volume among multiple namespaces. // Note that this capability needs to be disabled only for CSI drivers that break CSI boundary and // inspect Kubernetes PersistentVolume objects. A CSI driver that implements only CSI and does not // talk to Kubernetes API server in any way should keep this capability enabled, because // they will see the same NodeStage / NodePublish requests as if only one PV existed. CapMultiplePVsSameID Capability = "multiplePVsSameID" // The driver supports ReadOnlyMany (ROX) access mode CapReadOnlyMany Capability = "capReadOnlyMany" )
Constants related to capabilities and behavior of the driver.
type CustomTimeoutsTestDriver ¶
type CustomTimeoutsTestDriver interface { TestDriver GetTimeouts() *framework.TimeoutContext }
CustomTimeoutsTestDriver represents an interface fo a TestDriver that supports custom timeouts.
type DriverInfo ¶
type DriverInfo struct { // Internal name of the driver, this is used as a display name in the test // case and test objects Name string // Fully qualified plugin name as registered in Kubernetes of the in-tree // plugin if it exists and is empty if this DriverInfo represents a CSI // Driver InTreePluginName string TestTags []interface{} // tags for the driver (e.g. framework.WithSlow()) // Maximum single file size supported by this driver MaxFileSize int64 // The range of disk size supported by this driver SupportedSizeRange e2evolume.SizeRange // Map of string for supported fs type SupportedFsType sets.String // Map of string for supported mount option SupportedMountOption sets.String // [Optional] Map of string for required mount option RequiredMountOption sets.String // Map that represents plugin capabilities Capabilities map[Capability]bool // [Optional] List of access modes required for provisioning, defaults to // RWO if unset RequiredAccessModes []v1.PersistentVolumeAccessMode // [Optional] List of topology keys driver supports TopologyKeys []string // [Optional] Number of allowed topologies the driver requires. // Only relevant if TopologyKeys is set. Defaults to 1. // Example: multi-zonal disk requires at least 2 allowed topologies. NumAllowedTopologies int // [Optional] Scale parameters for stress tests. // TODO(#96241): Rename this field to reflect the tests that consume it. StressTestOptions *StressTestOptions // [Optional] Scale parameters for volume snapshot stress tests. VolumeSnapshotStressTestOptions *VolumeSnapshotStressTestOptions // [Optional] Parameters for performance tests PerformanceTestOptions *PerformanceTestOptions }
DriverInfo represents static information about a TestDriver.
type DynamicPVTestDriver ¶
type DynamicPVTestDriver interface { TestDriver // GetDynamicProvisionStorageClass returns a StorageClass dynamic provision Persistent Volume. // The StorageClass must have // a unique name because GetDynamicProvisionStorageClass might // be called more than once per test. // It will set fsType to the StorageClass, if TestDriver supports it. // It will return nil, if the TestDriver doesn't support it. GetDynamicProvisionStorageClass(ctx context.Context, config *PerTestConfig, fsType string) *storagev1.StorageClass }
DynamicPVTestDriver represents an interface for a TestDriver that supports DynamicPV
type EphemeralTestDriver ¶
type EphemeralTestDriver interface { TestDriver // 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 return volume attributes, // whether the resulting volume is shared between different pods (i.e. // changes made in one pod are visible in another), and whether the // volume can be mounted read/write or only read-only. GetVolume(config *PerTestConfig, volumeNumber int) (attributes map[string]string, shared bool, readOnly bool) // GetCSIDriverName returns the name that was used when registering with // kubelet. Depending on how the driver was deployed, this can be different // from DriverInfo.Name. Starting with Kubernetes 1.16, there must also // be a CSIDriver object under the same name with a "mode" field that enables // usage of the driver for ephemeral inline volumes. GetCSIDriverName(config *PerTestConfig) string }
EphemeralTestDriver represents an interface for a TestDriver that supports ephemeral inline volumes.
type InlineVolumeTestDriver ¶
type InlineVolumeTestDriver interface { PreprovisionedVolumeTestDriver // GetVolumeSource returns a volumeSource for inline volume. // It will set readOnly and fsType to the volumeSource, if TestDriver supports both of them. // It will return nil, if the TestDriver doesn't support either of the parameters. GetVolumeSource(readOnly bool, fsType string, testVolume TestVolume) *v1.VolumeSource }
InlineVolumeTestDriver represents an interface for a TestDriver that supports InlineVolume
type Metrics ¶
Metrics to evaluate performance of an operation TODO: Add metrics like median, mode, standard deviation, percentile
type PerTestConfig ¶
type PerTestConfig struct { // The test driver for the test. Driver TestDriver // Some short word that gets inserted into dynamically // generated entities (pods, paths) as first part of the name // to make debugging easier. Can be the same for different // tests inside the test suite. Prefix string // The framework instance allocated for the current test. Framework *framework.Framework // If non-empty, Pods using a volume will be scheduled // according to the NodeSelection. Otherwise Kubernetes will // pick a node. ClientNodeSelection e2epod.NodeSelection // Some test drivers initialize a storage server. This is // the configuration that then has to be used to run tests. // The values above are ignored for such tests. ServerConfig *e2evolume.TestConfig // Some drivers run in their own namespace DriverNamespace *v1.Namespace }
PerTestConfig represents parameters that control test execution. One instance gets allocated for each test and is then passed via pointer to functions involved in the test.
func (*PerTestConfig) GetUniqueDriverName ¶
func (config *PerTestConfig) GetUniqueDriverName() string
GetUniqueDriverName returns unique driver name that can be used parallelly in tests
type PerformanceTestOptions ¶
type PerformanceTestOptions struct {
ProvisioningOptions *PerformanceTestProvisioningOptions
}
PerformanceTestOptions contains parameters used for performance tests
type PerformanceTestProvisioningOptions ¶
type PerformanceTestProvisioningOptions struct { VolumeSize string Count int // Expected metrics from PVC creation till PVC being Bound. ExpectedMetrics *Metrics }
PerformanceTestProvisioningOptions contains parameters for testing provisioning operation performance.
type PreprovisionedPVTestDriver ¶
type PreprovisionedPVTestDriver interface { PreprovisionedVolumeTestDriver // GetPersistentVolumeSource returns a PersistentVolumeSource with volume node affinity for pre-provisioned Persistent Volume. // It will set readOnly and fsType to the PersistentVolumeSource, if TestDriver supports both of them. // It will return nil, if the TestDriver doesn't support either of the parameters. GetPersistentVolumeSource(readOnly bool, fsType string, testVolume TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) }
PreprovisionedPVTestDriver represents an interface for a TestDriver that supports PreprovisionedPV
type PreprovisionedVolumeTestDriver ¶
type PreprovisionedVolumeTestDriver interface { TestDriver // CreateVolume creates a pre-provisioned volume of the desired volume type. CreateVolume(ctx context.Context, config *PerTestConfig, volumeType TestVolType) TestVolume }
PreprovisionedVolumeTestDriver represents an interface for a TestDriver that has pre-provisioned volume
type SnapshotResource ¶
type SnapshotResource struct { Config *PerTestConfig Pattern TestPattern Vs *unstructured.Unstructured Vscontent *unstructured.Unstructured Vsclass *unstructured.Unstructured }
SnapshotResource represents a snapshot class, a snapshot and its bound snapshot contents for a specific test case
func CreateSnapshotResource ¶
func CreateSnapshotResource(ctx context.Context, sDriver SnapshottableTestDriver, config *PerTestConfig, pattern TestPattern, pvcName string, pvcNamespace string, timeouts *framework.TimeoutContext, parameters map[string]string) *SnapshotResource
CreateSnapshotResource creates a snapshot resource for the current test. It knows how to deal with different test pattern snapshot provisioning and deletion policy
func (*SnapshotResource) CleanupResource ¶
func (sr *SnapshotResource) CleanupResource(ctx context.Context, timeouts *framework.TimeoutContext) error
CleanupResource cleans up the snapshot resource and ignores not found errors
type SnapshottableTestDriver ¶
type SnapshottableTestDriver interface { TestDriver // GetSnapshotClass returns a SnapshotClass to create snapshot. // It will return nil, if the TestDriver doesn't support it. GetSnapshotClass(ctx context.Context, config *PerTestConfig, parameters map[string]string) *unstructured.Unstructured }
SnapshottableTestDriver represents an interface for a TestDriver that supports DynamicSnapshot
type StressTestOptions ¶
type StressTestOptions struct { // Number of pods to create in the test. This may also create // up to 1 volume per pod. NumPods int // Number of times to restart each Pod. NumRestarts int }
StressTestOptions contains parameters used for stress tests.
type TestDriver ¶
type TestDriver interface { // GetDriverInfo returns DriverInfo for the TestDriver. This must be static // information. GetDriverInfo() *DriverInfo // SkipUnsupportedTest skips test if Testpattern is not // suitable to test with the TestDriver. It gets called after // parsing parameters of the test suite and before the // framework is initialized. Cheap tests that just check // parameters like the cloud provider can and should be // done in SkipUnsupportedTest to avoid setting up more // expensive resources like framework.Framework. Tests that // depend on a connection to the cluster can be done in // PrepareTest once the framework is ready. SkipUnsupportedTest(TestPattern) // PrepareTest is called at test execution time each time a new test case is about to start. // It sets up all necessary resources and returns the per-test configuration. // Cleanup is handled via ginkgo.DeferCleanup inside PrepareTest. PrepareTest(ctx context.Context, f *framework.Framework) *PerTestConfig }
TestDriver represents an interface for a driver to be tested in TestSuite. Except for GetDriverInfo, all methods will be called at test runtime and thus can use e2eskipper.Skipf, framework.Fatal, Gomega assertions, etc.
type TestPattern ¶
type TestPattern struct { Name string // Name of TestPattern TestTags []interface{} // additional parameters for framework.It, like framework.WithDisruptive() VolType TestVolType // Volume type of the volume FsType string // Fstype of the volume VolMode v1.PersistentVolumeMode // PersistentVolumeMode of the volume SnapshotType TestSnapshotType // Snapshot type of the snapshot SnapshotDeletionPolicy TestSnapshotDeletionPolicy // Deletion policy of the snapshot class BindingMode storagev1.VolumeBindingMode // VolumeBindingMode of the volume AllowExpansion bool // AllowVolumeExpansion flag of the StorageClass }
TestPattern represents a combination of parameters to be tested in a TestSuite
type TestSnapshotDeletionPolicy ¶
type TestSnapshotDeletionPolicy string
TestSnapshotDeletionPolicy represents the deletion policy of the snapshot class
var ( // DeleteSnapshot represents delete policy DeleteSnapshot TestSnapshotDeletionPolicy = "Delete" // RetainSnapshot represents retain policy RetainSnapshot TestSnapshotDeletionPolicy = "Retain" )
func (TestSnapshotDeletionPolicy) String ¶
func (t TestSnapshotDeletionPolicy) String() string
type TestSnapshotType ¶
type TestSnapshotType string
TestSnapshotType represents a snapshot type to be tested in a TestSuite
var ( // DynamicCreatedSnapshot represents a snapshot type for dynamic created snapshot DynamicCreatedSnapshot TestSnapshotType = "DynamicSnapshot" // PreprovisionedCreatedSnapshot represents a snapshot type for pre-provisioned snapshot PreprovisionedCreatedSnapshot TestSnapshotType = "PreprovisionedSnapshot" VolumeGroupSnapshot TestSnapshotType = "VolumeGroupSnapshot" )
type TestSuite ¶
type TestSuite interface { GetTestSuiteInfo() TestSuiteInfo // DefineTests defines tests of the testpattern for the driver. // Called inside a Ginkgo context that reflects the current driver and test pattern, // so the test suite can define tests directly with ginkgo.It. DefineTests(TestDriver, TestPattern) // SkipUnsupportedTests will skip the test suite based on the given TestPattern, TestDriver // Testsuite should check if the given pattern and driver works for the "whole testsuite" // Testcase specific check should happen inside defineTests SkipUnsupportedTests(TestDriver, TestPattern) }
TestSuite represents an interface for a set of tests which works with TestDriver. Each testsuite should implement this interface. All the functions except GetTestSuiteInfo() should not be called directly. Instead, use RegisterTests() to register the tests in a more standard way.
type TestSuiteInfo ¶
type TestSuiteInfo struct { Name string // name of the TestSuite TestTags []interface{} // additional parameters for framework.It, like framework.WithDisruptive() TestPatterns []TestPattern // Slice of TestPattern for the TestSuite SupportedSizeRange e2evolume.SizeRange // Size range supported by the test suite }
TestSuiteInfo represents a set of parameters for TestSuite
type TestVolType ¶
type TestVolType string
TestVolType represents a volume type to be tested in a TestSuite
var ( // InlineVolume represents a volume type that is used inline in volumeSource InlineVolume TestVolType = "InlineVolume" // PreprovisionedPV represents a volume type for pre-provisioned Persistent Volume PreprovisionedPV TestVolType = "PreprovisionedPV" // DynamicPV represents a volume type for dynamic provisioned Persistent Volume DynamicPV TestVolType = "DynamicPV" // CSIInlineVolume represents a volume type that is defined inline and provided by a CSI driver. CSIInlineVolume TestVolType = "CSIInlineVolume" // GenericEphemeralVolume represents a volume type that is defined inline and provisioned through a PVC. GenericEphemeralVolume TestVolType = "GenericEphemeralVolume" )
type TestVolume ¶
TestVolume is the result of PreprovisionedVolumeTestDriver.CreateVolume. The only common functionality is to delete it. Individual driver interfaces have additional methods that work with volumes created by them.
func CreateVolume ¶
func CreateVolume(ctx context.Context, driver TestDriver, config *PerTestConfig, volType TestVolType) TestVolume
CreateVolume creates volume for test unless dynamicPV or CSI ephemeral inline volume test
type VolumeAttributesClassTestDriver ¶ added in v1.31.0
type VolumeAttributesClassTestDriver interface { TestDriver // GetVolumeAttributesClass returns a VolumeAttributesClass to create/modify PVCs // It will return nil if the TestDriver does not support VACs GetVolumeAttributesClass(ctx context.Context, config *PerTestConfig) *storagev1beta1.VolumeAttributesClass }
VolumeAttributesClassTestDriver represents an interface for a TestDriver that supports creating and modifying volumes via VolumeAttributesClass objects
type VolumeGroupSnapshotResource ¶ added in v1.32.0
type VolumeGroupSnapshotResource struct { Config *PerTestConfig Pattern TestPattern Vgs *unstructured.Unstructured Vgscontent *unstructured.Unstructured Vgsclass *unstructured.Unstructured }
VolumeGroupSnapshotResource represents a volumegroupsnapshot class, a volumegroupsnapshot and its bound contents for a specific test case
func CreateVolumeGroupSnapshotResource ¶ added in v1.32.0
func CreateVolumeGroupSnapshotResource(ctx context.Context, sDriver VoulmeGroupSnapshottableTestDriver, config *PerTestConfig, pattern TestPattern, pvcName string, pvcNamespace string, timeouts *framework.TimeoutContext, parameters map[string]string) *VolumeGroupSnapshotResource
CreateVolumeGroupSnapshotResource creates a VolumeGroupSnapshotResource object with the given parameters.
func (*VolumeGroupSnapshotResource) CleanupResource ¶ added in v1.32.0
func (r *VolumeGroupSnapshotResource) CleanupResource(ctx context.Context, timeouts *framework.TimeoutContext) error
CleanupResource deletes the VolumeGroupSnapshotClass and VolumeGroupSnapshot objects using a dynamic client.
type VolumeResource ¶
type VolumeResource struct { Config *PerTestConfig Pattern TestPattern VolSource *v1.VolumeSource Pvc *v1.PersistentVolumeClaim Pv *v1.PersistentVolume Sc *storagev1.StorageClass Volume TestVolume }
VolumeResource is a generic implementation of TestResource that wil be able to be used in most of TestSuites. See volume_io.go or volumes.go in test/e2e/storage/testsuites/ for how to use this resource. Also, see subpath.go in the same directory for how to extend and use it.
func CreateVolumeResource ¶
func CreateVolumeResource(ctx context.Context, driver TestDriver, config *PerTestConfig, pattern TestPattern, testVolumeSizeRange e2evolume.SizeRange) *VolumeResource
CreateVolumeResource constructs a VolumeResource for the current test. It knows how to deal with different test pattern volume types.
func CreateVolumeResourceWithAccessModes ¶ added in v1.26.0
func CreateVolumeResourceWithAccessModes(ctx context.Context, driver TestDriver, config *PerTestConfig, pattern TestPattern, testVolumeSizeRange e2evolume.SizeRange, accessModes []v1.PersistentVolumeAccessMode, vacName *string) *VolumeResource
CreateVolumeResourceWithAccessModes constructs a VolumeResource for the current test with the provided access modes.
func CreateVolumeResourceWithVAC ¶ added in v1.31.0
func CreateVolumeResourceWithVAC(ctx context.Context, driver TestDriver, config *PerTestConfig, pattern TestPattern, testVolumeSizeRange e2evolume.SizeRange, vacName *string) *VolumeResource
CreateVolumeResource constructs a VolumeResource for the current test using the specified VAC name.
func (*VolumeResource) CleanupResource ¶
func (r *VolumeResource) CleanupResource(ctx context.Context) error
CleanupResource cleans up VolumeResource
type VolumeSnapshotStressTestOptions ¶
type VolumeSnapshotStressTestOptions struct { // Number of pods to create in the test. This may also create // up to 1 volume per pod. NumPods int // Number of snapshots to create for each volume. NumSnapshots int }
VolumeSnapshotStressTestOptions contains parameters used for volume snapshot stress tests.
type VoulmeGroupSnapshottableTestDriver ¶ added in v1.32.0
type VoulmeGroupSnapshottableTestDriver interface { TestDriver // GetVolumeGroupSnapshotClass returns a VolumeGroupSnapshotClass to create group snapshot. GetVolumeGroupSnapshotClass(ctx context.Context, config *PerTestConfig, parameters map[string]string) *unstructured.Unstructured }