Documentation ¶
Index ¶
- Constants
- func AddToFrameworkScheme(addToScheme addToSchemeFunc, obj runtime.Object) error
- func MainEntry(m *testing.M)
- type CleanupOptions
- type Context
- func (ctx *Context) AddCleanupFn(fn cleanupFn)
- func (ctx *Context) Cleanup()
- func (ctx *Context) GetID() string
- func (ctx *Context) GetNamespace() (string, error)
- func (ctx *Context) GetOperatorNamespace() (string, error)
- func (ctx *Context) GetWatchNamespace() (string, error)
- func (ctx *Context) InitializeClusterResources(cleanupOptions *CleanupOptions) error
- type Framework
- type FrameworkClient
- type TestCtxdeprecated
- func NewTestCtx(t *testing.T) *TestCtxdeprecated
Constants ¶
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 ¶
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
Types ¶
type CleanupOptions ¶ added in v0.0.7
type Context ¶ added in v0.16.0
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶ added in v0.16.0
func (*Context) AddCleanupFn ¶ added in v0.16.0
func (ctx *Context) AddCleanupFn(fn cleanupFn)
func (*Context) GetNamespace ¶ added in v0.16.0
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
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
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 }