Documentation ¶
Index ¶
- func CreateDriverArchive(archiveName, pkgPath, binPath string) (string, error)
- func GetComputeClient(ctx context.Context, computeEndpoint string) (*compute.Service, error)
- func GetFileClient(ctx context.Context, filestoreEndpoint string) (*filev1beta1.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, sizeBytes int64) error
- func (c *CsiClient) ControllerExpandVolumeWithLimit(volumeID string, sizeBytes, limitBytes int64) error
- func (c *CsiClient) CreateSnapshot(snapshotName, sourceVolumeId string) (string, error)
- func (c *CsiClient) CreateVolume(volName, zone, snapshotID string, parameters map[string]string) (*csipb.Volume, error)
- func (c *CsiClient) DeleteSnapshot(snapshotID string) error
- func (c *CsiClient) DeleteVolume(volId string) 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) NodePublishVolume(volumeId, stageDir, publishDir string, volumeAttrs map[string]string) error
- func (c *CsiClient) NodeStageVolume(volumeId, stageDir string, volumeAttrs map[string]string) error
- func (c *CsiClient) NodeUnpublishVolume(volumeId, publishDir string) error
- func (c *CsiClient) NodeUnstageVolume(volumeId, stageDir string) error
- type InstanceInfo
- func (i *InstanceInfo) CreateOrGetInstance(serviceAccount string) error
- func (i *InstanceInfo) CreateSSHTunnel(localPort, serverPort string) (int, error)
- func (i *InstanceInfo) DeleteInstance()
- func (i *InstanceInfo) GetIdentity() (string, string, string)
- func (i *InstanceInfo) GetName() 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 GetComputeClient ¶
func GetFileClient ¶ added in v0.3.1
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.3.1
func (*CsiClient) ControllerExpandVolumeWithLimit ¶ added in v0.3.1
func (*CsiClient) CreateSnapshot ¶ added in v0.3.1
func (*CsiClient) CreateVolume ¶
func (*CsiClient) DeleteSnapshot ¶ added in v0.3.1
func (*CsiClient) DeleteVolume ¶
func (*CsiClient) NodeGetInfo ¶
func (c *CsiClient) NodeGetInfo() (*csipb.NodeGetInfoResponse, error)
func (*CsiClient) NodeGetVolumeStats ¶ added in v1.2.1
func (*CsiClient) NodePublishVolume ¶
func (*CsiClient) NodeStageVolume ¶ added in v0.3.1
func (*CsiClient) NodeUnpublishVolume ¶
func (*CsiClient) NodeUnstageVolume ¶ added in v0.3.1
type InstanceInfo ¶
type InstanceInfo struct {
// contains filtered or unexported fields
}
func CreateInstanceInfo ¶
func CreateInstanceInfo(project, instanceZone, name string, cs *compute.Service) (*InstanceInfo, error)
func SetupInstance ¶
func SetupInstance(instanceProject, instanceZone, instanceName, instanceServiceAccount string, cs *compute.Service) (*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(serviceAccount string) 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) GetIdentity ¶
func (i *InstanceInfo) GetIdentity() (string, string, string)
func (*InstanceInfo) GetName ¶
func (i *InstanceInfo) GetName() 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 SSH 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.