tester

package
v0.0.0-...-9cd5fb2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(t *testing.T, scheme *runtime.Scheme, input kclient.Object, existing ...kclient.Object) router.Request

func NewRequestWithContext

func NewRequestWithContext(t *testing.T, ctx context.Context, scheme *runtime.Scheme, input kclient.Object, existing ...kclient.Object) router.Request

Types

type Client

type Client struct {
	Objects   []kclient.Object
	SchemeObj *runtime.Scheme
	Created   []kclient.Object
	Updated   []kclient.Object
}

func (*Client) Create

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

func (*Client) Delete

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

func (*Client) DeleteAllOf

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

func (*Client) Get

func (c *Client) Get(ctx context.Context, key kclient.ObjectKey, out kclient.Object, opts ...kclient.GetOption) error

func (*Client) GroupVersionKindFor

func (c *Client) GroupVersionKindFor(obj runtime.Object) (schema.GroupVersionKind, error)

func (*Client) IsObjectNamespaced

func (c *Client) IsObjectNamespaced(obj runtime.Object) (bool, error)

func (*Client) List

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

func (*Client) Patch

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

func (*Client) RESTMapper

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

func (*Client) Scheme

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

func (*Client) Status

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

func (*Client) SubResource

func (c *Client) SubResource(subResource string) kclient.SubResourceClient

func (*Client) Update

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

type Harness

type Harness struct {
	Scheme             *runtime.Scheme
	Existing           []kclient.Object
	ExpectedOutput     []kclient.Object
	ExpectedGoldenPath string
	ExpectedDelay      time.Duration
}

func FromDir

func FromDir(scheme *runtime.Scheme, path string) (*Harness, kclient.Object, error)

func (*Harness) Invoke

func (b *Harness) Invoke(t *testing.T, input kclient.Object, handler router.Handler) (*Response, error)

func (*Harness) InvokeFunc

func (b *Harness) InvokeFunc(t *testing.T, input kclient.Object, handler router.HandlerFunc) (*Response, error)

func (*Harness) InvokeFuncWithContext

func (b *Harness) InvokeFuncWithContext(t *testing.T, ctx context.Context, input kclient.Object, handler router.HandlerFunc) (*Response, error)

func (*Harness) InvokeWithContext

func (b *Harness) InvokeWithContext(t *testing.T, ctx context.Context, input kclient.Object, handler router.Handler) (*Response, error)

func (*Harness) SanitizedYAML

func (b *Harness) SanitizedYAML(t *testing.T, objs []kclient.Object) string

type ObjectKey

type ObjectKey struct {
	GVK       schema.GroupVersionKind
	Namespace string
	Name      string
}

type Response

type Response struct {
	router.ResponseAttributes

	Delay     time.Duration
	Collected []kclient.Object
	Client    *Client
	NoPrune   bool
}

func DefaultTest

func DefaultTest(t *testing.T, scheme *runtime.Scheme, path string, handler router.HandlerFunc) (result *Response)

func (*Response) DisablePrune

func (r *Response) DisablePrune()

func (*Response) Objects

func (r *Response) Objects(obj ...kclient.Object)

func (*Response) RetryAfter

func (r *Response) RetryAfter(delay time.Duration)

Jump to

Keyboard shortcuts

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