unittestcommon

package
v2.5.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 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) 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) 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