test

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Kubeconfigs = calculate()
View Source
var PerformCleanup = func(t *testing.T) bool {
	return true
}

Functions

func Cleanup

func Cleanup(contexts ...*Context)

Cleanup for all given contexts

func CleanupAll

func CleanupAll()

CleanupAll cleans all created contexts

func CleanupOnInterrupt

func CleanupOnInterrupt(t *testing.T, cleanup CleanupFunc)

CleanupOnInterrupt will execute the function cleanup if an interrupt signal is caught

func CreateSubscription

func CreateSubscription(ctx *Context, subscriptionName string, packageName string) (*v1alpha1.Subscription, error)

func IsCSVSucceeded

func IsCSVSucceeded(c *v1alpha1.ClusterServiceVersion, err error) (bool, error)

func IsSubscriptionInstalledCSVPresent

func IsSubscriptionInstalledCSVPresent(s *v1alpha1.Subscription, err error) (bool, error)

func Subscription

func Subscription(subscriptionName string, packageName string) *v1alpha1.Subscription

func WaitForClusterServiceVersionState

func WaitForClusterServiceVersionState(ctx *Context, name, namespace string, inState func(s *v1alpha1.ClusterServiceVersion, err error) (bool, error)) (*v1alpha1.ClusterServiceVersion, error)

func WaitForSubscriptionState

func WaitForSubscriptionState(ctx *Context, name, namespace string, inState func(s *v1alpha1.Subscription, err error) (bool, error)) (*v1alpha1.Subscription, error)

func WithOperatorReady

func WithOperatorReady(ctx *Context, subscriptionName string, packageName string) (*v1alpha1.Subscription, error)

Types

type CleanupFunc

type CleanupFunc func() error

CleanupFunc defines a function that is called when the respective resource should be deleted. When creating resources the user should also create a CleanupFunc and register with the Context

type Clients

type Clients struct {
	KubeClient *test.KubeClient
	Dynamic    dynamic.Interface
	Config     *rest.Config
	OLM        olmversioned.Interface
	Apps       *k8sv1.AppsV1Client
}

Clients holds instances of interfaces for making requests

func NewClients

func NewClients(configPath string, clusterName string) (*Clients, error)

NewClients instantiates and returns several clientsets required for making request to the cluster specified by the combination of clusterName and configPath.

type Context

type Context struct {
	Name        string
	T           *testing.T
	Clients     *Clients
	CleanupList []CleanupFunc
}

Context holds objects related to test execution

func NewContext

func NewContext(t *testing.T, role string, idx int) *Context

func (*Context) AddToCleanup

func (ctx *Context) AddToCleanup(f CleanupFunc)

AddToCleanup adds the cleanup function as the first function to the cleanup list, we want to delete the last thing first

func (*Context) Cleanup

func (ctx *Context) Cleanup()

Cleanup iterates through the list of registered CleanupFunc functions and calls them

Jump to

Keyboard shortcuts

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