utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakePVName        = "fake-pv"
	FakePVCName       = "fake-pvc"
	FakeSCName        = "fake-sc"
	FakeDriverName    = "fake-csi-driver"
	FakeRemoteSCName  = "fake-remote-sc"
	FakeRGName        = "fake-rg"
	FakeNamespaceName = "fake-namespace"
	Self              = "self"
	RemoteClusterID   = "remoteCluster"
	SourceClusterID   = "sourceCluster"
	LocalPGID         = "l-group-id"
	RemotePGID        = "r-group-id"
	ContextPrefix     = "csi-fake"
)
View Source
const PVCName = "test-pvc"

Variables

View Source
var MockServer *grpc.Server
View Source
var Scheme = runtime.NewScheme()

Functions

func GetConfigFromFile

func GetConfigFromFile(kubeconfig string) (*rest.Config, error)

GetConfigFromFile creates *rest.Config object from provided config path

func GetFakeClient

func GetFakeClient() client.Client

func GetFakeClientWithObjects

func GetFakeClientWithObjects(initObjs ...client.Object) client.Client

func GetLogger

func GetLogger() logr.Logger

func GetNonReplicationEnabledSC

func GetNonReplicationEnabledSC(provisionerName, scName string) *storagev1.StorageClass

func GetPVCObj

func GetPVCObj(pvcName string, namespace string, sc string) *v1.PersistentVolumeClaim

func GetPVObj

func GetPVObj(name, volHandle, provisionerName, scName string, volAttributes map[string]string) *v1.PersistentVolume

func GetParams

func GetParams(remoteClusterID, remoteSCName string) map[string]string

func GetRGObj

func GetRGObj(name, driverName, remoteClusterID, pgID, remotePGID string, params,
	remoteParams map[string]string) *storagev1alpha1.DellCSIReplicationGroup

func GetReplicationEnabledSC

func GetReplicationEnabledSC(provisionerName, scName, remoteSCName, remoteClusterID string) *storagev1.StorageClass

func InitializeSchemes

func InitializeSchemes()

func RunServer

func RunServer(stubsPath string)

func StopMockServer

func StopMockServer()

func ValidateAnnotations

func ValidateAnnotations(annotations map[string]string, t *testing.T)

func ValidateRemotePVAnnotations

func ValidateRemotePVAnnotations(annotations map[string]string, t *testing.T)

func ValidateRemoteRGAnnotations

func ValidateRemoteRGAnnotations(annotations map[string]string, t *testing.T)

func WaitForAllToBeBound

func WaitForAllToBeBound(ctx context.Context, k8sClient client.Client, t *testing.T) error

WaitForAllToBeBound waits for every PVC, that belongs to PVCClient, to be Bound

Types

type Common

type Common struct {
	Namespace string
}

type Driver

type Driver struct {
	DriverName      string
	StorageClass    string
	RemoteClusterID string
	RemoteSCName    string
	SourceClusterID string
	Namespace       string
	RGName          string
	PVName          string
}

func GetDefaultDriver

func GetDefaultDriver() Driver

type MockUtils

type MockUtils struct {
	FakeClient           *fake_client.Client
	Specs                Common
	FakeControllerClient client.Client
}

Jump to

Keyboard shortcuts

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