testutil

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IsAddonsv1alpha1AddonPtr            = mock.IsType(&addonsv1alpha1.Addon{})
	IsContext                           = mock.IsType(context.TODO())
	IsCoreV1NamespacePtr                = mock.IsType(&corev1.Namespace{})
	IsCoreV1NamespaceListPtr            = mock.IsType(&corev1.NamespaceList{})
	IsObjectKey                         = mock.IsType(client.ObjectKey{})
	IsOperatorsV1Alpha1CatalogSourcePtr = mock.IsType(&operatorsv1alpha1.CatalogSource{})
)

custom testify/mock matchers

Functions

func IsWebhookServerEnabled added in v0.3.0

func IsWebhookServerEnabled() bool

func NewAddonWithInstallSpec added in v0.3.0

func NewAddonWithInstallSpec(installSpec addonsv1alpha1.AddonInstallSpec,
	addonName string) *addonsv1alpha1.Addon

NewAddonWithInstallSpec returns an Addon object with the specified InstallSpec

func NewStatusError added in v0.3.0

func NewStatusError(msg string) *k8sApiErrors.StatusError

NewStatusError returns an error of type `StatusError `

Types

type Client

type Client struct {
	mock.Mock

	StatusMock *StatusClient
}

Client is a mock for the controller-runtime dynamic client interface.

func NewClient

func NewClient() *Client

func (*Client) Create

func (c *Client) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*Client) DeleteAllOf

func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, key types.NamespacedName, obj client.Object) error

func (*Client) List

func (c *Client) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*Client) RESTMapper

func (c *Client) RESTMapper() meta.RESTMapper

func (*Client) Scheme

func (c *Client) Scheme() *runtime.Scheme

func (*Client) Status

func (c *Client) Status() client.StatusWriter

func (*Client) Update

func (c *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type Logger

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

Logger implements logr.Logger and logs to testing.T to preserve the order of log lines in tests.

func NewLogger

func NewLogger(t *testing.T) *Logger

NewLogger returns a new Logger flushing to testing.T.

func (*Logger) Enabled

func (l *Logger) Enabled() bool

Enabled implements logr.Logger.Enabled

func (*Logger) Error

func (l *Logger) Error(err error, msg string, kvs ...interface{})

Error implements logr.Logger.Error

func (*Logger) Info

func (l *Logger) Info(msg string, kvs ...interface{})

Info implements logr.Logger.Info

func (*Logger) V

func (l *Logger) V(level int) logr.Logger

V implements logr.Logger.V

func (*Logger) WithName

func (l *Logger) WithName(name string) logr.Logger

WithName implements logr.Logger.WithName

func (*Logger) WithValues

func (l *Logger) WithValues(kvs ...interface{}) logr.Logger

WithValues implements logr.Logger.WithValues

type StatusClient

type StatusClient struct {
	mock.Mock
}

func (*StatusClient) Patch

func (c *StatusClient) Patch(
	ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*StatusClient) Update

func (c *StatusClient) Update(
	ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

Jump to

Keyboard shortcuts

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