var ( // ErrNoCredentials is the error when a secret is enabled but not passed in the request. ErrNoCredentials = errors.New("secret must be provided") // ErrAuthFailed is the error when the secret is incorrect. ErrAuthFailed = errors.New("authentication failed") )
CSICreds is a driver specific secret type. Drivers can have a key-val pair of secrets. This mock driver has a single string secret with secretField as the key.
type CSICreds struct { CreateVolumeSecret string DeleteVolumeSecret string ControllerPublishVolumeSecret string ControllerUnpublishVolumeSecret string NodeStageVolumeSecret string NodePublishVolumeSecret string CreateSnapshotSecret string DeleteSnapshotSecret string ControllerValidateVolumeCapabilitiesSecret string }
type CSIDriver struct {
// contains filtered or unexported fields
}
func NewCSIDriver(servers *CSIDriverServers) *CSIDriver
func (c *CSIDriver) Address() string
func (c *CSIDriver) Close()
func (c *CSIDriver) IsRunning() bool
func (c *CSIDriver) SetDefaultCreds()
SetDefaultCreds sets the default secrets for CSI creds.
func (c *CSIDriver) Start(l net.Listener, interceptor grpc.UnaryServerInterceptor) error
Start runs a gRPC server with all enabled services. If an interceptor is give, then it will be used. Otherwise, an interceptor which handles simple credential checks and logs gRPC calls in JSON format will be used.
func (c *CSIDriver) Stop()
CSIDriverServers is a unified driver component with both Controller and Node services.
type CSIDriverServers struct { Controller csi.ControllerServer Identity csi.IdentityServer Node csi.NodeServer }
type LogGRPC func(method string, request, reply interface{}, err error)
type MockCSIDriver struct { CSIDriver // contains filtered or unexported fields }
func NewMockCSIDriver(servers *MockCSIDriverServers, interceptor grpc.UnaryServerInterceptor) *MockCSIDriver
func (m *MockCSIDriver) Close()
func (m *MockCSIDriver) Start() error
Start starts a new gRPC server listening on a random TCP loopback port.
func (m *MockCSIDriver) StartOnAddress(network, address string) error
StartOnAddress starts a new gRPC server listening on given address.
type MockCSIDriverServers struct { Controller *MockControllerServer Identity *MockIdentityServer Node *MockNodeServer }
MockControllerServer is a mock of ControllerServer interface.
type MockControllerServer struct {
// contains filtered or unexported fields
}
func NewMockControllerServer(ctrl *gomock.Controller) *MockControllerServer
NewMockControllerServer creates a new mock instance.
func (m *MockControllerServer) ControllerExpandVolume(arg0 context.Context, arg1 *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
ControllerExpandVolume mocks base method.
func (m *MockControllerServer) ControllerGetCapabilities(arg0 context.Context, arg1 *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
ControllerGetCapabilities mocks base method.
func (m *MockControllerServer) ControllerGetVolume(arg0 context.Context, arg1 *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error)
ControllerGetVolume mocks base method.
func (m *MockControllerServer) ControllerPublishVolume(arg0 context.Context, arg1 *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error)
ControllerPublishVolume mocks base method.
func (m *MockControllerServer) ControllerUnpublishVolume(arg0 context.Context, arg1 *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error)
ControllerUnpublishVolume mocks base method.
func (m *MockControllerServer) CreateSnapshot(arg0 context.Context, arg1 *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error)
CreateSnapshot mocks base method.
func (m *MockControllerServer) CreateVolume(arg0 context.Context, arg1 *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
CreateVolume mocks base method.
func (m *MockControllerServer) DeleteSnapshot(arg0 context.Context, arg1 *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error)
DeleteSnapshot mocks base method.
func (m *MockControllerServer) DeleteVolume(arg0 context.Context, arg1 *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
DeleteVolume mocks base method.
func (m *MockControllerServer) EXPECT() *MockControllerServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockControllerServer) GetCapacity(arg0 context.Context, arg1 *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)
GetCapacity mocks base method.
func (m *MockControllerServer) ListSnapshots(arg0 context.Context, arg1 *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)
ListSnapshots mocks base method.
func (m *MockControllerServer) ListVolumes(arg0 context.Context, arg1 *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)
ListVolumes mocks base method.
func (m *MockControllerServer) ValidateVolumeCapabilities(arg0 context.Context, arg1 *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
ValidateVolumeCapabilities mocks base method.
MockControllerServerMockRecorder is the mock recorder for MockControllerServer.
type MockControllerServerMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockControllerServerMockRecorder) ControllerExpandVolume(arg0, arg1 interface{}) *gomock.Call
ControllerExpandVolume indicates an expected call of ControllerExpandVolume.
func (mr *MockControllerServerMockRecorder) ControllerGetCapabilities(arg0, arg1 interface{}) *gomock.Call
ControllerGetCapabilities indicates an expected call of ControllerGetCapabilities.
func (mr *MockControllerServerMockRecorder) ControllerGetVolume(arg0, arg1 interface{}) *gomock.Call
ControllerGetVolume indicates an expected call of ControllerGetVolume.
func (mr *MockControllerServerMockRecorder) ControllerPublishVolume(arg0, arg1 interface{}) *gomock.Call
ControllerPublishVolume indicates an expected call of ControllerPublishVolume.
func (mr *MockControllerServerMockRecorder) ControllerUnpublishVolume(arg0, arg1 interface{}) *gomock.Call
ControllerUnpublishVolume indicates an expected call of ControllerUnpublishVolume.
func (mr *MockControllerServerMockRecorder) CreateSnapshot(arg0, arg1 interface{}) *gomock.Call
CreateSnapshot indicates an expected call of CreateSnapshot.
func (mr *MockControllerServerMockRecorder) CreateVolume(arg0, arg1 interface{}) *gomock.Call
CreateVolume indicates an expected call of CreateVolume.
func (mr *MockControllerServerMockRecorder) DeleteSnapshot(arg0, arg1 interface{}) *gomock.Call
DeleteSnapshot indicates an expected call of DeleteSnapshot.
func (mr *MockControllerServerMockRecorder) DeleteVolume(arg0, arg1 interface{}) *gomock.Call
DeleteVolume indicates an expected call of DeleteVolume.
func (mr *MockControllerServerMockRecorder) GetCapacity(arg0, arg1 interface{}) *gomock.Call
GetCapacity indicates an expected call of GetCapacity.
func (mr *MockControllerServerMockRecorder) ListSnapshots(arg0, arg1 interface{}) *gomock.Call
ListSnapshots indicates an expected call of ListSnapshots.
func (mr *MockControllerServerMockRecorder) ListVolumes(arg0, arg1 interface{}) *gomock.Call
ListVolumes indicates an expected call of ListVolumes.
func (mr *MockControllerServerMockRecorder) ValidateVolumeCapabilities(arg0, arg1 interface{}) *gomock.Call
ValidateVolumeCapabilities indicates an expected call of ValidateVolumeCapabilities.
MockIdentityServer is a mock of IdentityServer interface.
type MockIdentityServer struct {
// contains filtered or unexported fields
}
func NewMockIdentityServer(ctrl *gomock.Controller) *MockIdentityServer
NewMockIdentityServer creates a new mock instance.
func (m *MockIdentityServer) EXPECT() *MockIdentityServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockIdentityServer) GetPluginCapabilities(arg0 context.Context, arg1 *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
GetPluginCapabilities mocks base method.
func (m *MockIdentityServer) GetPluginInfo(arg0 context.Context, arg1 *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
GetPluginInfo mocks base method.
func (m *MockIdentityServer) Probe(arg0 context.Context, arg1 *csi.ProbeRequest) (*csi.ProbeResponse, error)
Probe mocks base method.
MockIdentityServerMockRecorder is the mock recorder for MockIdentityServer.
type MockIdentityServerMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockIdentityServerMockRecorder) GetPluginCapabilities(arg0, arg1 interface{}) *gomock.Call
GetPluginCapabilities indicates an expected call of GetPluginCapabilities.
func (mr *MockIdentityServerMockRecorder) GetPluginInfo(arg0, arg1 interface{}) *gomock.Call
GetPluginInfo indicates an expected call of GetPluginInfo.
func (mr *MockIdentityServerMockRecorder) Probe(arg0, arg1 interface{}) *gomock.Call
Probe indicates an expected call of Probe.
MockNodeServer is a mock of NodeServer interface.
type MockNodeServer struct {
// contains filtered or unexported fields
}
func NewMockNodeServer(ctrl *gomock.Controller) *MockNodeServer
NewMockNodeServer creates a new mock instance.
func (m *MockNodeServer) EXPECT() *MockNodeServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockNodeServer) NodeExpandVolume(arg0 context.Context, arg1 *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
NodeExpandVolume mocks base method.
func (m *MockNodeServer) NodeGetCapabilities(arg0 context.Context, arg1 *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
NodeGetCapabilities mocks base method.
func (m *MockNodeServer) NodeGetInfo(arg0 context.Context, arg1 *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
NodeGetInfo mocks base method.
func (m *MockNodeServer) NodeGetVolumeStats(arg0 context.Context, arg1 *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
NodeGetVolumeStats mocks base method.
func (m *MockNodeServer) NodePublishVolume(arg0 context.Context, arg1 *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
NodePublishVolume mocks base method.
func (m *MockNodeServer) NodeStageVolume(arg0 context.Context, arg1 *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
NodeStageVolume mocks base method.
func (m *MockNodeServer) NodeUnpublishVolume(arg0 context.Context, arg1 *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
NodeUnpublishVolume mocks base method.
func (m *MockNodeServer) NodeUnstageVolume(arg0 context.Context, arg1 *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
NodeUnstageVolume mocks base method.
MockNodeServerMockRecorder is the mock recorder for MockNodeServer.
type MockNodeServerMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockNodeServerMockRecorder) NodeExpandVolume(arg0, arg1 interface{}) *gomock.Call
NodeExpandVolume indicates an expected call of NodeExpandVolume.
func (mr *MockNodeServerMockRecorder) NodeGetCapabilities(arg0, arg1 interface{}) *gomock.Call
NodeGetCapabilities indicates an expected call of NodeGetCapabilities.
func (mr *MockNodeServerMockRecorder) NodeGetInfo(arg0, arg1 interface{}) *gomock.Call
NodeGetInfo indicates an expected call of NodeGetInfo.
func (mr *MockNodeServerMockRecorder) NodeGetVolumeStats(arg0, arg1 interface{}) *gomock.Call
NodeGetVolumeStats indicates an expected call of NodeGetVolumeStats.
func (mr *MockNodeServerMockRecorder) NodePublishVolume(arg0, arg1 interface{}) *gomock.Call
NodePublishVolume indicates an expected call of NodePublishVolume.
func (mr *MockNodeServerMockRecorder) NodeStageVolume(arg0, arg1 interface{}) *gomock.Call
NodeStageVolume indicates an expected call of NodeStageVolume.
func (mr *MockNodeServerMockRecorder) NodeUnpublishVolume(arg0, arg1 interface{}) *gomock.Call
NodeUnpublishVolume indicates an expected call of NodeUnpublishVolume.
func (mr *MockNodeServerMockRecorder) NodeUnstageVolume(arg0, arg1 interface{}) *gomock.Call
NodeUnstageVolume indicates an expected call of NodeUnstageVolume.