framework

package
Version: v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 21 Imported by: 10

Documentation

Index

Constants

View Source
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

View Source
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,
	}
	// 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",
		FeatureTag: "[Slow]",
	}
	// XfsCSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (xfs)"
	XfsCSIEphemeralVolume = TestPattern{
		Name:       "CSI Ephemeral-volume (xfs)",
		VolType:    CSIInlineVolume,
		FsType:     "xfs",
		FeatureTag: "[Slow]",
	}
	// XfsGenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (xfs)"
	XfsGenericEphemeralVolume = TestPattern{
		Name:       "Generic Ephemeral-volume (xfs)",
		VolType:    GenericEphemeralVolume,
		FsType:     "xfs",
		FeatureTag: "[Slow]",
	}
	// XfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (xfs)"
	XfsPreprovisionedPV = TestPattern{
		Name:       "Pre-provisioned PV (xfs)",
		VolType:    PreprovisionedPV,
		FsType:     "xfs",
		FeatureTag: "[Slow]",
	}
	// XfsDynamicPV is TestPattern for "Dynamic PV (xfs)"
	XfsDynamicPV = TestPattern{
		Name:                   "Dynamic PV (xfs)",
		VolType:                DynamicPV,
		FsType:                 "xfs",
		FeatureTag:             "[Slow]",
		SnapshotType:           DynamicCreatedSnapshot,
		SnapshotDeletionPolicy: DeleteSnapshot,
	}

	// NtfsInlineVolume is TestPattern for "Inline-volume (ntfs)"
	NtfsInlineVolume = TestPattern{
		Name:       "Inline-volume (ntfs)",
		VolType:    InlineVolume,
		FsType:     "ntfs",
		FeatureTag: "[Feature:Windows]",
	}
	// NtfsCSIEphemeralVolume is TestPattern for "CSI Ephemeral-volume (ntfs)"
	NtfsCSIEphemeralVolume = TestPattern{
		Name:       "CSI Ephemeral-volume (ntfs) [alpha]",
		VolType:    CSIInlineVolume,
		FsType:     "ntfs",
		FeatureTag: "[Feature:Windows]",
	}
	// NtfsGenericEphemeralVolume is TestPattern for "Generic Ephemeral-volume (ntfs)"
	NtfsGenericEphemeralVolume = TestPattern{
		Name:       "Generic Ephemeral-volume (ntfs)",
		VolType:    GenericEphemeralVolume,
		FsType:     "ntfs",
		FeatureTag: "[Feature:Windows]",
	}
	// NtfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (ntfs)"
	NtfsPreprovisionedPV = TestPattern{
		Name:       "Pre-provisioned PV (ntfs)",
		VolType:    PreprovisionedPV,
		FsType:     "ntfs",
		FeatureTag: "[Feature:Windows]",
	}
	// NtfsDynamicPV is TestPattern for "Dynamic PV (ntfs)"
	NtfsDynamicPV = TestPattern{
		Name:                   "Dynamic PV (ntfs)",
		VolType:                DynamicPV,
		FsType:                 "ntfs",
		FeatureTag:             "[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,
	}

	// DynamicSnapshotDelete is TestPattern for "Dynamic snapshot"
	DynamicSnapshotDelete = TestPattern{
		Name:                   "Dynamic Snapshot (delete policy)",
		SnapshotType:           DynamicCreatedSnapshot,
		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,
	}
	// 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,
	}

	// 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",
		FeatureTag:     "[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 CreateSnapshot

func CreateSnapshot(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 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) string

GetDriverNameWithFeatureTags returns driver name with feature tags 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
	CapExec               Capability = "exec"               // exec a file in the volume
	CapSnapshotDataSource Capability = "snapshotDataSource" // support populate data from 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
	CapOnlineExpansion     Capability = "onlineExpansion"     // supports online volume expansion
	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"
)

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
	FeatureTag       string // FeatureTag for the driver

	// 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 be created in the current test's namespace and have
	// a unique name inside that namespace 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(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

type Metrics struct {
	AvgLatency time.Duration
	Throughput float64
}

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(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(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(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(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
	// plus a cleanup function that frees all allocated resources.
	PrepareTest(f *framework.Framework) (*PerTestConfig, func())
}

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
	FeatureTag             string                      // featureTag for the TestSuite
	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

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"
)

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
	FeatureTag         string              // featureTag for the TestSuite
	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

type TestVolume interface {
	DeleteVolume()
}

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(driver TestDriver, config *PerTestConfig, volType TestVolType) TestVolume

CreateVolume creates volume for test unless dynamicPV or CSI ephemeral inline volume test

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(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 (*VolumeResource) CleanupResource

func (r *VolumeResource) CleanupResource() 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.

Jump to

Keyboard shortcuts

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