Documentation ¶
Index ¶
- func CreateDriverArchive(archiveName, architecture, pkgPath, binPath string) (string, error)
- func GetComputeAlphaClient() (*computealpha.Service, error)
- func GetComputeBetaClient() (*computebeta.Service, error)
- func GetComputeClient() (*compute.Service, error)
- func NewWorkspaceDir(workspaceDirPrefix string) string
- func TeardownDriverAndClient(context *TestContext) error
- type ClientConfig
- type CsiClient
- func (c *CsiClient) AssertCSIConnection() error
- func (c *CsiClient) CloseConn() error
- func (c *CsiClient) ControllerExpandVolume(volumeID string, sizeGb int64) error
- func (c *CsiClient) ControllerModifyVolume(volId string, mutableParameters map[string]string) error
- func (c *CsiClient) ControllerPublishVolume(volId, nodeId string, forceAttach bool, readOnly bool) error
- func (c *CsiClient) ControllerPublishVolumeReadOnly(volId, nodeId string) error
- func (c *CsiClient) ControllerPublishVolumeReadWrite(volId, nodeId string, forceAttach bool) error
- func (c *CsiClient) ControllerUnpublishVolume(volId, nodeId string) error
- func (c *CsiClient) CreateSnapshot(snapshotName, sourceVolumeId string, params map[string]string) (string, error)
- func (c *CsiClient) CreateVolume(volName string, params map[string]string, sizeInGb int64, ...) (*csipb.Volume, error)
- func (c *CsiClient) CreateVolumeWithCaps(volName string, params map[string]string, sizeInGb int64, ...) (*csipb.Volume, error)
- func (c *CsiClient) DeleteSnapshot(snapshotID string) error
- func (c *CsiClient) DeleteVolume(volId string) error
- func (c *CsiClient) ListVolumes() (map[string]([]string), error)
- func (c *CsiClient) NodeExpandVolume(volumeID, volumePath string, sizeGb int64) (*csipb.NodeExpandVolumeResponse, error)
- func (c *CsiClient) NodeGetInfo() (*csipb.NodeGetInfoResponse, error)
- func (c *CsiClient) NodeGetVolumeStats(volumeID, volumePath string) (available, capacity, used, inodesFree, inodes, inodesUsed int64, err error)
- func (c *CsiClient) NodePublishBlockVolume(volumeID, stageDir, publishDir string) error
- func (c *CsiClient) NodePublishVolume(volumeID, stageDir, publishDir string) error
- func (c *CsiClient) NodeStageBlockVolume(volId, stageDir string) error
- func (c *CsiClient) NodeStageExt4Volume(volId, stageDir string) error
- func (c *CsiClient) NodeStageVolume(volId, stageDir string, volumeCap *csipb.VolumeCapability) error
- func (c *CsiClient) NodeUnpublishVolume(volumeID, publishDir string) error
- func (c *CsiClient) NodeUnstageVolume(volId, stageDir string) error
- type InstanceConfig
- type InstanceInfo
- func (i *InstanceInfo) CreateOrGetInstance() error
- func (i *InstanceInfo) CreateSSHTunnel(localPort, serverPort string) (int, error)
- func (i *InstanceInfo) DeleteInstance()
- func (i *InstanceInfo) DetachDisk(diskName string) error
- func (i *InstanceInfo) GetIdentity() (string, string, string)
- func (i *InstanceInfo) GetName() string
- func (i *InstanceInfo) GetNodeID() string
- func (i *InstanceInfo) GetSSHTarget() string
- func (i *InstanceInfo) SSH(cmd ...string) (string, error)
- func (i *InstanceInfo) SSHCheckAlive() (string, error)
- func (i *InstanceInfo) SSHNoSudo(cmd ...string) (string, error)
- func (i *InstanceInfo) UploadAndRun(archivePath, remoteWorkspace, driverRunCmd string) (int, error)
- type TestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDriverArchive ¶
func GetComputeAlphaClient ¶ added in v1.0.0
func GetComputeAlphaClient() (*computealpha.Service, error)
func GetComputeBetaClient ¶ added in v1.7.10
func GetComputeBetaClient() (*computebeta.Service, error)
func GetComputeClient ¶
func NewWorkspaceDir ¶
func TeardownDriverAndClient ¶
func TeardownDriverAndClient(context *TestContext) error
TeardownDriverAndClient closes the CSI Client connection, closes the SSH tunnel Kills the driver process on the GCE instance, and cleans up the remote driver workspace
Types ¶
type ClientConfig ¶
type ClientConfig struct { // Absolute path of the package PkgPath string // Absolute path of the driver binary to copy remotely BinPath string // Path on remote instance workspace WorkspaceDir string // Command to run on remote instance to start the driver RunDriverCmd string // Port to use as SSH tunnel on both remote and local side. Port string }
ClientConfig contains all the parameters required to package a new driver and run it remotely on a GCE Instance
type CsiClient ¶
type CsiClient struct {
// contains filtered or unexported fields
}
func CreateCSIClient ¶
func (*CsiClient) AssertCSIConnection ¶
func (*CsiClient) ControllerExpandVolume ¶ added in v0.6.0
func (*CsiClient) ControllerModifyVolume ¶ added in v1.15.0
func (*CsiClient) ControllerPublishVolume ¶
func (*CsiClient) ControllerPublishVolumeReadOnly ¶ added in v1.13.1
func (*CsiClient) ControllerPublishVolumeReadWrite ¶ added in v1.13.1
func (*CsiClient) ControllerUnpublishVolume ¶
func (*CsiClient) CreateSnapshot ¶
func (*CsiClient) CreateVolume ¶
func (*CsiClient) CreateVolumeWithCaps ¶ added in v1.0.0
func (c *CsiClient) CreateVolumeWithCaps(volName string, params map[string]string, sizeInGb int64, topReq *csipb.TopologyRequirement, caps []*csipb.VolumeCapability, volContentSrc *csipb.VolumeContentSource) (*csipb.Volume, error)
func (*CsiClient) DeleteSnapshot ¶
func (*CsiClient) DeleteVolume ¶
func (*CsiClient) ListVolumes ¶ added in v0.7.0
func (*CsiClient) NodeExpandVolume ¶ added in v0.6.0
func (*CsiClient) NodeGetInfo ¶
func (c *CsiClient) NodeGetInfo() (*csipb.NodeGetInfoResponse, error)
func (*CsiClient) NodeGetVolumeStats ¶ added in v0.7.0
func (*CsiClient) NodePublishBlockVolume ¶ added in v0.6.0
func (*CsiClient) NodePublishVolume ¶
func (*CsiClient) NodeStageBlockVolume ¶ added in v0.6.0
func (*CsiClient) NodeStageExt4Volume ¶ added in v0.6.0
func (*CsiClient) NodeStageVolume ¶
func (c *CsiClient) NodeStageVolume(volId, stageDir string, volumeCap *csipb.VolumeCapability) error
func (*CsiClient) NodeUnpublishVolume ¶
func (*CsiClient) NodeUnstageVolume ¶
type InstanceConfig ¶ added in v1.14.0
type InstanceConfig struct { Project string Architecture string Zone string Name string MachineType string ServiceAccount string ImageURL string CloudtopHost bool MinCpuPlatform string ComputeService *compute.Service EnableConfidentialCompute bool }
InstanceConfig is the common bundle of options used for instance creation.
type InstanceInfo ¶
type InstanceInfo struct {
// contains filtered or unexported fields
}
func SetupInstance ¶
func SetupInstance(cfg InstanceConfig) (*InstanceInfo, error)
SetupInstance sets up the specified GCE Instance for E2E testing and returns a handle to the instance object for future use.
func (*InstanceInfo) CreateOrGetInstance ¶
func (i *InstanceInfo) CreateOrGetInstance() error
Provision a gce instance using image
func (*InstanceInfo) CreateSSHTunnel ¶
func (i *InstanceInfo) CreateSSHTunnel(localPort, serverPort string) (int, error)
func (*InstanceInfo) DeleteInstance ¶
func (i *InstanceInfo) DeleteInstance()
func (*InstanceInfo) DetachDisk ¶ added in v1.9.0
func (i *InstanceInfo) DetachDisk(diskName string) error
func (*InstanceInfo) GetIdentity ¶
func (i *InstanceInfo) GetIdentity() (string, string, string)
func (*InstanceInfo) GetName ¶
func (i *InstanceInfo) GetName() string
func (*InstanceInfo) GetNodeID ¶
func (i *InstanceInfo) GetNodeID() string
func (*InstanceInfo) GetSSHTarget ¶
func (i *InstanceInfo) GetSSHTarget() string
GetHostnameOrIP converts hostname into ip and apply user if necessary.
func (*InstanceInfo) SSH ¶
func (i *InstanceInfo) SSH(cmd ...string) (string, error)
SSH executes ssh command with runSSHCommand as root. The `sudo` makes sure that all commands are executed by root, so that there won't be permission mismatch between different commands.
func (*InstanceInfo) SSHCheckAlive ¶
func (i *InstanceInfo) SSHCheckAlive() (string, error)
SSHCheckAlive just pings the server quickly to check whether it is reachable by SSH
func (*InstanceInfo) SSHNoSudo ¶
func (i *InstanceInfo) SSHNoSudo(cmd ...string) (string, error)
SSHNoSudo executes ssh command with runSSHCommand as normal user. Sometimes we need this, for example creating a directory that we'll copy files there with scp.
func (*InstanceInfo) UploadAndRun ¶
func (i *InstanceInfo) UploadAndRun(archivePath, remoteWorkspace, driverRunCmd string) (int, error)
type TestContext ¶
type TestContext struct { Instance *InstanceInfo Client *CsiClient // contains filtered or unexported fields }
TestContext holds the CSI Client handle to a remotely connected Driver as well as a handle to the Instance that the driver is running on
func SetupNewDriverAndClient ¶
func SetupNewDriverAndClient(instance *InstanceInfo, config *ClientConfig) (*TestContext, error)
SetupNewDriverAndClient gets the driver binary, runs it on the provided instance and connects a CSI client to it through SHH tunnelling. It returns a TestContext with both a handle to the instance that the driver is on and the CSI Client object to make CSI calls to the remote driver.