unittestcommon

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFakeContainerOrchestratorInterface

func GetFakeContainerOrchestratorInterface(orchestratorType int) (commonco.COCommonInterface, error)

GetFakeContainerOrchestratorInterface returns a dummy CO interface based on the CO type

func InitFakeVolumeOperationRequestInterface

func InitFakeVolumeOperationRequestInterface() (cnsvolumeoperationrequest.VolumeOperationRequest, error)

InitFakeVolumeOperationRequestInterface returns a fake implementation of the VolumeOperationRequest interface.

Types

type FakeK8SOrchestrator

type FakeK8SOrchestrator struct {
	// contains filtered or unexported fields
}

FakeK8SOrchestrator is used to mock common K8S Orchestrator instance to store FSS values

func (*FakeK8SOrchestrator) AnnotateVolumeSnapshot added in v2.7.0

func (c *FakeK8SOrchestrator) AnnotateVolumeSnapshot(ctx context.Context, volumeSnapshotName string,
	volumeSnapshotNamespace string, annotations map[string]string) (bool, error)

AnnotateVolumeSnapshot annotates the volumesnapshot CR in k8s cluster

func (*FakeK8SOrchestrator) ClearFakeAttached

func (c *FakeK8SOrchestrator) ClearFakeAttached(ctx context.Context, volumeID string) error

ClearFakeAttached checks if the volume was fake attached, and unmark it as not fake attached.

func (*FakeK8SOrchestrator) GetAllK8sVolumes added in v2.6.0

func (c *FakeK8SOrchestrator) GetAllK8sVolumes() []string

GetAllK8sVolumes returns list of volumes in a bound state, present in the K8s cluster

func (*FakeK8SOrchestrator) GetAllVolumes added in v2.6.0

func (c *FakeK8SOrchestrator) GetAllVolumes() []string

GetAllVolumes returns list of volumes in a bound state

func (*FakeK8SOrchestrator) GetFakeAttachedVolumes added in v2.6.0

func (c *FakeK8SOrchestrator) GetFakeAttachedVolumes(ctx context.Context, volumeID []string) map[string]bool

GetFakeAttachedVolumes returns a map of volumeIDs to a bool, which is set to true if volumeID key is fake attached else false

func (*FakeK8SOrchestrator) GetNodeIDtoNameMap added in v2.6.0

func (c *FakeK8SOrchestrator) GetNodeIDtoNameMap(ctx context.Context) map[string]string

GetNodeIDtoNameMap returns a map containing the nodeID to node name

func (*FakeK8SOrchestrator) GetNodesForVolumes added in v2.6.0

func (c *FakeK8SOrchestrator) GetNodesForVolumes(ctx context.Context, volumeID []string) map[string][]string

GetNodesForVolumes returns nodeNames to which the given volumeIDs are attached

func (*FakeK8SOrchestrator) GetVolumeAttachment added in v2.6.0

func (c *FakeK8SOrchestrator) GetVolumeAttachment(ctx context.Context, volumeId string, nodeName string) (
	*storagev1.VolumeAttachment, error)

GetVolumeAttachment returns the VA object by using the given volumeId & nodeName

func (*FakeK8SOrchestrator) InitTopologyServiceInController

func (c *FakeK8SOrchestrator) InitTopologyServiceInController(ctx context.Context) (
	commoncotypes.ControllerTopologyService, error)

InitTopologyServiceInController returns a singleton implementation of the commoncotypes.ControllerTopologyService interface for the FakeK8SOrchestrator.

func (*FakeK8SOrchestrator) InitTopologyServiceInNode

func (c *FakeK8SOrchestrator) InitTopologyServiceInNode(ctx context.Context) (
	commoncotypes.NodeTopologyService, error)

InitTopologyServiceInNode returns a singleton implementation of the commoncotypes.NodeTopologyService interface for the FakeK8SOrchestrator.

func (*FakeK8SOrchestrator) IsFSSEnabled

func (c *FakeK8SOrchestrator) IsFSSEnabled(ctx context.Context, featureName string) bool

IsFSSEnabled returns the FSS values for a given feature

func (*FakeK8SOrchestrator) IsFakeAttachAllowed

func (c *FakeK8SOrchestrator) IsFakeAttachAllowed(
	ctx context.Context,
	volumeID string,
	volumeManager cnsvolume.Manager,
) (bool, error)

IsFakeAttachAllowed checks if the passed volume can be fake attached and mark it as fake attached.

func (*FakeK8SOrchestrator) MarkFakeAttached

func (c *FakeK8SOrchestrator) MarkFakeAttached(ctx context.Context, volumeID string) error

MarkFakeAttached marks the volume as fake attached.

type MockVolumeMigrationService

type MockVolumeMigrationService interface {
	// GetVolumeID returns VolumeID for given migration volumeSpec
	// Returns an error if not able to retrieve VolumeID.
	GetVolumeID(ctx context.Context, volumeSpec *migration.VolumeSpec) (string, error)

	// GetVolumePath returns VolumePath for given VolumeID
	// Returns an error if not able to retrieve VolumePath.
	GetVolumePath(ctx context.Context, volumeID string) (string, error)

	// DeleteVolumeInfo helps delete mapping of volumePath to VolumeID for specified volumeID
	DeleteVolumeInfo(ctx context.Context, volumeID string) error
}

MockVolumeMigrationService is a mocked VolumeMigrationService needed for CSI migration feature

func GetFakeVolumeMigrationService

func GetFakeVolumeMigrationService(
	ctx context.Context,
	volumeManager *cnsvolume.Manager,
	cnsConfig *cnsconfig.Config,
) (MockVolumeMigrationService, error)

GetFakeVolumeMigrationService returns the mocked VolumeMigrationService

Jump to

Keyboard shortcuts

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