tests

package
v0.0.0-...-a88c85e Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

README

Behavior Driven Development(BDD)

Maya makes use of ginkgo & gomega libraries to implement its integration tests.

To run the BDD test:

  1. Copy kubeconfig file into path ~/.kube/config or set the KUBECONFIG env.
  2. Change the current directory path to test related directory Example: To trigger the statefulesets test Step1: Change the pwd to test directory. cd github.com/openebs/maya/tests/sts/ Step2: Execute the command ginkgo -v -- -kubeconfig=/path/to/kubeconfig

Output: Sample example output

Running Suite: StatefulSet
==========================
Random Seed: 1555919486
Will run 1 of 2 specs

StatefulSet test statefulset application on cstor
  should distribute the cstor volume replicas across pools
  /home/sai/gocode/src/github.com/openebs/maya/tests/sts/sts_test.go:227
---------------------------------------------------------

Ran 1 of 1 Specs in 767.022 seconds
FAIL! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped

Ginkgo ran 1 suite in 12m49.573774959s
Test Suite Failed

Note: Above is the sample output how it looks when you ran ginkgo -v -- -kubeconfig=/path/to/kubeconfig

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operations

type Operations struct {
	KubeClient     *kubeclient.Client
	NodeClient     *node.Kubeclient
	PodClient      *pod.KubeClient
	SCClient       *sc.Kubeclient
	PVCClient      *pvc.Kubeclient
	NSClient       *ns.Kubeclient
	SnapClient     *snap.Kubeclient
	CSPClient      *csp.Kubeclient
	CSPIClient     *cspi.Kubeclient
	SPCClient      *spc.Kubeclient
	SVCClient      *svc.Kubeclient
	CVClient       *cv.Kubeclient
	CVCClient      *cvc.Kubeclient
	CSPCClient     *cspc.Kubeclient
	CVRClient      *cvr.Kubeclient
	URClient       *result.Kubeclient
	UnstructClient *unstruct.Kubeclient
	DeployClient   *deploy.Kubeclient
	BDClient       *bd.Kubeclient
	BDCClient      *bdc.Kubeclient
	KubeConfigPath string
}

Operations provides clients amd methods to perform operations

func NewOperations

func NewOperations(opts ...OperationsOptions) *Operations

NewOperations returns a new instance of kubeclient meant for cstor volume replica operations

func (*Operations) DeleteCSP

func (ops *Operations) DeleteCSP(spcName string, deleteCount int)

DeleteCSP ...

func (*Operations) ExecPod

func (ops *Operations) ExecPod(opts *Options) ([]byte, error)

ExecPod executes arbitrary command inside the pod

func (*Operations) ExecuteCMDEventually

func (ops *Operations) ExecuteCMDEventually(
	podObj *corev1.Pod,
	containerName,
	cmd string,
) string

ExecuteCMDEventually executes the command on pod container and returns stdout

func (*Operations) GetBDCCount

func (ops *Operations) GetBDCCount(lSelector, namespace string) int

GetBDCCount gets BDC resource count based on provided label selector

func (*Operations) GetBDCCountEventually

func (ops *Operations) GetBDCCountEventually(listOptions metav1.ListOptions, expectedBDCCount int, namespace string) int

GetBDCCountEventually gets BDC resource count based on provided list option.

func (*Operations) GetCSPCount

func (ops *Operations) GetCSPCount(labelSelector string) int

GetCSPCount gets csp count based on spcName at that time

func (*Operations) GetCVCount

func (ops *Operations) GetCVCount(namespace, lselector string) int

GetCVCount gives cstorvolume healthy count currently based on selecter

func (*Operations) GetCstorVolumeClaimCount

func (ops *Operations) GetCstorVolumeClaimCount(namespace, cvcName string) int

GetCstorVolumeClaimCount gives cstorVolumeClaim healthy count currently

func (*Operations) GetCstorVolumeClaimCountEventually

func (ops *Operations) GetCstorVolumeClaimCountEventually(namespace, cvcName string, expectedCVCCount int) bool

GetCstorVolumeClaimCountEventually gives the count of cstorvolume claim

func (*Operations) GetCstorVolumeCount

func (ops *Operations) GetCstorVolumeCount(namespace, lselector string, expectedCVCount int) int

GetCstorVolumeCount gives the count of cstorvolume based on selecter

func (*Operations) GetCstorVolumeCountEventually

func (ops *Operations) GetCstorVolumeCountEventually(namespace, lselector string, expectedCVCount int) bool

GetCstorVolumeCountEventually gives the count of cstorvolume based on selecter eventually

func (*Operations) GetCstorVolumeReplicaCount

func (ops *Operations) GetCstorVolumeReplicaCount(namespace, lselector string) int

GetCstorVolumeReplicaCount gives cstorvolumereplica healthy count currently based on selecter

func (*Operations) GetCstorVolumeReplicaCountEventually

func (ops *Operations) GetCstorVolumeReplicaCountEventually(namespace, lselector string, expectedCVRCount int) bool

GetCstorVolumeReplicaCountEventually gives the count of cstorvolume based on selecter eventually

func (*Operations) GetHealthyCSPCount

func (ops *Operations) GetHealthyCSPCount(spcName string, expectedCSPCount int) int

GetHealthyCSPCount gets healthy csp based on spcName

func (*Operations) GetHealthyCSPCountEventually

func (ops *Operations) GetHealthyCSPCountEventually(spcName string, expectedCSPCount int) bool

GetHealthyCSPCountEventually gets healthy csp based on spcName

func (*Operations) GetHealthyCSPICount

func (ops *Operations) GetHealthyCSPICount(cspcName string, expectedCSPICount int) int

GetHealthyCSPICount gets healthy csp based on spcName

func (*Operations) GetPVNameFromPVCName

func (ops *Operations) GetPVNameFromPVCName(pvcName string) string

GetPVNameFromPVCName gives the pv name for the given pvc

func (*Operations) GetPodCompletedCount

func (ops *Operations) GetPodCompletedCount(namespace, lselector string) int

GetPodCompletedCount gives number of pods running currently

func (*Operations) GetPodCompletedCountEventually

func (ops *Operations) GetPodCompletedCountEventually(namespace, lselector string, expectedPodCount int) int

GetPodCompletedCountEventually gives the number of pods running eventually

func (*Operations) GetPodRunningCount

func (ops *Operations) GetPodRunningCount(namespace, lselector string) int

GetPodRunningCount gives number of pods running currently

func (*Operations) GetPodRunningCountEventually

func (ops *Operations) GetPodRunningCountEventually(namespace, lselector string, expectedPodCount int) int

GetPodRunningCountEventually gives the number of pods running eventually

func (*Operations) GetReadyNodes

func (ops *Operations) GetReadyNodes() *corev1.NodeList

GetReadyNodes gives cstorvolumereplica healthy count currently based on selecter

func (*Operations) GetSnapshotType

func (ops *Operations) GetSnapshotType(snapName string) string

GetSnapshotType returns type of snapshot currently

func (*Operations) GetSnapshotTypeEventually

func (ops *Operations) GetSnapshotTypeEventually(snapName string) string

GetSnapshotTypeEventually returns type of snapshot eventually

func (*Operations) IsCSPCDeletedEventually

func (ops *Operations) IsCSPCDeletedEventually(cspcName string) bool

IsCSPCDeletedEventually tries to get the deleted cspc and returns true if cspc is not found else returns false

func (*Operations) IsFinalizerExistsOnBDC

func (ops *Operations) IsFinalizerExistsOnBDC(bdcName, finalizer string) bool

IsFinalizerExistsOnBDC returns true if the object with provided name contains the finalizer.

func (*Operations) IsPVCBound

func (ops *Operations) IsPVCBound(pvcName string) bool

IsPVCBound checks if the pvc is bound or not

func (*Operations) IsPVCBoundEventually

func (ops *Operations) IsPVCBoundEventually(pvcName string) bool

IsPVCBoundEventually checks if the pvc is bound or not eventually

func (*Operations) IsPVCDeleted

func (ops *Operations) IsPVCDeleted(pvcName string) bool

IsPVCDeleted tries to get the deleted pvc and returns true if pvc is not found else returns false

func (*Operations) IsPVCDeletedEventually

func (ops *Operations) IsPVCDeletedEventually(pvcName string) bool

IsPVCDeletedEventually tries to get the deleted pvc and returns true if pvc is not found else returns false

func (*Operations) IsPodDeletedEventually

func (ops *Operations) IsPodDeletedEventually(namespace, podName string) bool

IsPodDeletedEventually checks if the pod is deleted or not eventually

func (*Operations) IsPodRunningEventually

func (ops *Operations) IsPodRunningEventually(namespace, podName string) bool

IsPodRunningEventually return true if the pod comes to running state

func (*Operations) IsSPCFinalizerExistsOnBDCs

func (ops *Operations) IsSPCFinalizerExistsOnBDCs(listOptions metav1.ListOptions, spcFinalizer string) bool

IsSPCFinalizerExistsOnBDCs returns true if the all the BDCs( selected by provided list options) has spc finalizer on it.

func (*Operations) IsSPCFinalizerExistsOnSPC

func (ops *Operations) IsSPCFinalizerExistsOnSPC(spcName, spcFinalizer string) bool

IsSPCFinalizerExistsOnSPC returns true if the spc with provided name contains the spc finalizer.

func (*Operations) IsSPCNotExists

func (ops *Operations) IsSPCNotExists(spcName string) bool

IsSPCNotExists returns true if the spc with provided name does not exists.

func (*Operations) IsSnapshotDeleted

func (ops *Operations) IsSnapshotDeleted(snapName string) bool

IsSnapshotDeleted checks if the snapshot is deleted or not

func (*Operations) PodDeleteCollection

func (ops *Operations) PodDeleteCollection(ns string, lopts metav1.ListOptions) error

PodDeleteCollection deletes all the pods in a namespace matched the given labelselector

func (*Operations) RestartPodEventually

func (ops *Operations) RestartPodEventually(podObj *corev1.Pod) error

RestartPodEventually restarts the pod and return

func (*Operations) VerifyCapacity

func (ops *Operations) VerifyCapacity(pvcName, capacity string) bool

VerifyCapacity checks if the pvc capacity has been updated

func (*Operations) VerifyOpenebs

func (ops *Operations) VerifyOpenebs(expectedPodCount int) *Operations

VerifyOpenebs verify running state of required openebs control plane components

func (*Operations) VerifyUpgradeResultTasksIsNotFail

func (ops *Operations) VerifyUpgradeResultTasksIsNotFail(namespace, lselector string) bool

VerifyUpgradeResultTasksIsNotFail checks whether all the tasks in upgraderesult have success

type OperationsOptions

type OperationsOptions func(*Operations)

OperationsOptions abstracts creating an instance of operations

func WithKubeConfigPath

func WithKubeConfigPath(path string) OperationsOptions

WithKubeConfigPath sets the kubeConfig path against operations instance

type Options

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

Options holds the args used for exec'ing into the pod

func NewOptions

func NewOptions() *Options

NewOptions returns the new instance of Options

func (*Options) WithCommand

func (o *Options) WithCommand(cmd ...string) *Options

WithCommand fills the cmd field in Options struct

func (*Options) WithContainer

func (o *Options) WithContainer(container string) *Options

WithContainer fills the container field in Options struct

func (*Options) WithNamespace

func (o *Options) WithNamespace(ns string) *Options

WithNamespace fills the namespace field in Options struct

func (*Options) WithPodName

func (o *Options) WithPodName(name string) *Options

WithPodName fills the podName field in Options struct

Directories

Path Synopsis
csi
framework

Jump to

Keyboard shortcuts

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