Documentation ¶
Index ¶
- Constants
- func DescribeSanity(text string, body func(*SanityContext)) bool
- func GinkgoTest(reqConfig *Config)
- func MakeCreateSnapshotReq(sc *SanityContext, name, sourceVolumeId string, parameters map[string]string) *csi.CreateSnapshotRequest
- func MakeCreateVolumeReq(sc *SanityContext, name string) *csi.CreateVolumeRequest
- func MakeDeleteSnapshotReq(sc *SanityContext, id string) *csi.DeleteSnapshotRequest
- func MakeDeleteVolumeReq(sc *SanityContext, id string) *csi.DeleteVolumeRequest
- func Test(t *testing.T, reqConfig *Config)
- func TestVolumeSize(sc *SanityContext) int64
- type CSISecrets
- type Cleanup
- type Config
- type SanityContext
- type VolumeInfo
Constants ¶
const ( // DefTestVolumeSize defines the base size of dynamically // provisioned volumes. 10GB by default, can be overridden by // setting Config.TestVolumeSize. DefTestVolumeSize int64 = 10 * 1024 * 1024 * 1024 MaxNameLength int = 128 )
Variables ¶
This section is empty.
Functions ¶
func DescribeSanity ¶
func DescribeSanity(text string, body func(*SanityContext)) bool
DescribeSanity must be used instead of the usual Ginkgo Describe to register a test block. The difference is that the body function will be called multiple times with the right context (when setting up a Ginkgo suite or a testing.T test, with the right configuration).
func GinkgoTest ¶
func GinkgoTest(reqConfig *Config)
func MakeCreateSnapshotReq ¶
func MakeCreateSnapshotReq(sc *SanityContext, name, sourceVolumeId string, parameters map[string]string) *csi.CreateSnapshotRequest
func MakeCreateVolumeReq ¶
func MakeCreateVolumeReq(sc *SanityContext, name string) *csi.CreateVolumeRequest
func MakeDeleteSnapshotReq ¶
func MakeDeleteSnapshotReq(sc *SanityContext, id string) *csi.DeleteSnapshotRequest
func MakeDeleteVolumeReq ¶
func MakeDeleteVolumeReq(sc *SanityContext, id string) *csi.DeleteVolumeRequest
func Test ¶
Test will test the CSI driver at the specified address by setting up a Ginkgo suite and running it.
func TestVolumeSize ¶
func TestVolumeSize(sc *SanityContext) int64
Types ¶
type CSISecrets ¶
type CSISecrets struct { CreateVolumeSecret map[string]string `yaml:"CreateVolumeSecret"` DeleteVolumeSecret map[string]string `yaml:"DeleteVolumeSecret"` ControllerPublishVolumeSecret map[string]string `yaml:"ControllerPublishVolumeSecret"` ControllerUnpublishVolumeSecret map[string]string `yaml:"ControllerUnpublishVolumeSecret"` NodeStageVolumeSecret map[string]string `yaml:"NodeStageVolumeSecret"` NodePublishVolumeSecret map[string]string `yaml:"NodePublishVolumeSecret"` CreateSnapshotSecret map[string]string `yaml:"CreateSnapshotSecret"` DeleteSnapshotSecret map[string]string `yaml:"DeleteSnapshotSecret"` }
CSISecrets consists of secrets used in CSI credentials.
type Cleanup ¶
type Cleanup struct { Context *SanityContext ControllerClient csi.ControllerClient NodeClient csi.NodeClient ControllerPublishSupported bool NodeStageSupported bool // contains filtered or unexported fields }
Cleanup keeps track of resources, in particular volumes, which need to be freed when testing is done.
func (*Cleanup) DeleteVolumes ¶
func (cl *Cleanup) DeleteVolumes()
DeleteVolumes stops using the registered volumes and tries to delete all of them.
func (*Cleanup) MaybeRegisterVolume ¶
MaybeRegisterVolume adds or updates an entry for the volume with the given name if CreateVolume was successful.
func (*Cleanup) RegisterVolume ¶
func (cl *Cleanup) RegisterVolume(name string, info VolumeInfo)
RegisterVolume adds or updates an entry for the volume with the given name.
func (*Cleanup) UnregisterVolume ¶
UnregisterVolume removes the entry for the volume with the given name, thus preventing all cleanup operations for it.
type Config ¶
type Config struct { TargetPath string StagingPath string Address string SecretsFile string TestVolumeSize int64 }
Config provides the configuration for the sanity tests. It needs to be initialized by the user of the sanity package.
type SanityContext ¶
type SanityContext struct { Config *Config Conn *grpc.ClientConn Secrets *CSISecrets // contains filtered or unexported fields }
SanityContext holds the variables that each test can depend on. It gets initialized before each test block runs.
type VolumeInfo ¶
type VolumeInfo struct { // Node on which the volume was published, empty if none // or publishing is not supported. NodeID string // Volume ID assigned by CreateVolume. VolumeID string }
VolumeInfo keeps track of the information needed to delete a volume.