test

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjRootFlag           = "root"
	KubeConfigFlag         = "kubeconfig"
	NamespacedManPathFlag  = "namespacedMan"
	GlobalManPathFlag      = "globalMan"
	LocalOperatorFlag      = "localOperator"
	LocalOperatorArgs      = "localOperatorArgs"
	SkipCleanupOnErrorFlag = "skipCleanupOnError"

	TestOperatorNamespaceEnv = "TEST_OPERATOR_NAMESPACE"
	TestWatchNamespaceEnv    = "TEST_WATCH_NAMESPACE"
)

Variables

This section is empty.

Functions

func AddToFrameworkScheme

func AddToFrameworkScheme(addToScheme addToSchemeFunc, obj runtime.Object) error

AddToFrameworkScheme allows users to add the scheme for their custom resources to the framework's scheme for use with the dynamic client. The user provides the addToScheme function (located in the register.go file of their operator project) and the List struct for their custom resource. For example, for a memcached operator, the list stuct may look like: &MemcachedList{} The List object is needed because the CRD has not always been fully registered by the time this function is called. If the CRD takes more than 5 seconds to become ready, this function throws an error

func MainEntry

func MainEntry(m *testing.M)

Types

type CleanupOptions added in v0.0.7

type CleanupOptions struct {
	TestContext   *Context
	Timeout       time.Duration
	RetryInterval time.Duration
}

type Context added in v0.16.0

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

func NewContext added in v0.16.0

func NewContext(t *testing.T) *Context

func (*Context) AddCleanupFn added in v0.16.0

func (ctx *Context) AddCleanupFn(fn cleanupFn)

func (*Context) Cleanup added in v0.16.0

func (ctx *Context) Cleanup()

func (*Context) GetID added in v0.16.0

func (ctx *Context) GetID() string

func (*Context) GetNamespace added in v0.16.0

func (ctx *Context) GetNamespace() (string, error)

TODO: remove before 1.0.0 Deprecated: GetNamespace() exists for historical compatibility. Use GetOperatorNamespace() or GetWatchNamespace() instead

func (*Context) GetOperatorNamespace added in v0.17.0

func (ctx *Context) GetOperatorNamespace() (string, error)

GetOperatorNamespace will return an Operator Namespace, if the flag --operator-namespace not be used (TestOpeatorNamespaceEnv not set) then it will create a new namespace with randon name and return that namespace

func (*Context) GetWatchNamespace added in v0.17.0

func (ctx *Context) GetWatchNamespace() (string, error)

GetWatchNamespace will return the namespaces to operator watch for changes, if the flag --watch-namespaced not be used then it will return the Operator Namespace.

func (*Context) InitializeClusterResources added in v0.16.0

func (ctx *Context) InitializeClusterResources(cleanupOptions *CleanupOptions) error

type Framework

type Framework struct {
	Client            *frameworkClient
	KubeConfig        *rest.Config
	KubeClient        kubernetes.Interface
	Scheme            *runtime.Scheme
	NamespacedManPath *string
	OperatorNamespace string
	WatchNamespace    string

	LocalOperator bool
	// contains filtered or unexported fields
}
var (
	// Global framework struct
	Global *Framework
)

type FrameworkClient added in v0.0.7

type FrameworkClient interface {
	Get(gCtx goctx.Context, key dynclient.ObjectKey, obj runtime.Object) error
	List(gCtx goctx.Context, list runtime.Object, opts ...dynclient.ListOption) error
	Create(gCtx goctx.Context, obj runtime.Object, cleanupOptions *CleanupOptions) error
	Delete(gCtx goctx.Context, obj runtime.Object, opts ...dynclient.DeleteOption) error
	Update(gCtx goctx.Context, obj runtime.Object) error
}

type TestCtx deprecated

type TestCtx = Context //nolint:golint

Deprecated: TestCtx exists for historical compatibility. Use Context instead.

func NewTestCtx deprecated

func NewTestCtx(t *testing.T) *TestCtx

Deprecated: NewTestCtx exists for historical compatibility. Use NewContext instead.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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