kubetest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubectlOutput

type KubectlOutput struct {
	Output string
	Err    error
}

type MockKubectlCmd

type MockKubectlCmd struct {
	APIResources  []kube.APIResourceInfo
	Commands      map[string]KubectlOutput
	Events        chan watch.Event
	Version       string
	DynamicClient dynamic.Interface
	// contains filtered or unexported fields
}

func (*MockKubectlCmd) ConvertToVersion

func (k *MockKubectlCmd) ConvertToVersion(obj *unstructured.Unstructured, group, version string) (*unstructured.Unstructured, error)

ConvertToVersion converts an unstructured object into the specified group/version

func (*MockKubectlCmd) CreateResource

func (k *MockKubectlCmd) CreateResource(ctx context.Context, config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, obj *unstructured.Unstructured, createOptions metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error)

func (*MockKubectlCmd) DeleteResource

func (k *MockKubectlCmd) DeleteResource(ctx context.Context, config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, deleteOptions metav1.DeleteOptions) error

func (*MockKubectlCmd) GetAPIResources

func (k *MockKubectlCmd) GetAPIResources(config *rest.Config, preferred bool, resourceFilter kube.ResourceFilter) ([]kube.APIResourceInfo, error)

func (*MockKubectlCmd) GetResource

func (k *MockKubectlCmd) GetResource(ctx context.Context, config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string) (*unstructured.Unstructured, error)

func (*MockKubectlCmd) GetServerVersion

func (k *MockKubectlCmd) GetServerVersion(config *rest.Config) (string, error)

func (*MockKubectlCmd) LoadOpenAPISchema

func (k *MockKubectlCmd) LoadOpenAPISchema(config *rest.Config) (openapi.Resources, *managedfields.GvkParser, error)

func (*MockKubectlCmd) ManageResources

func (k *MockKubectlCmd) ManageResources(config *rest.Config, openAPISchema openapi.Resources) (kube.ResourceOperations, func(), error)

func (*MockKubectlCmd) NewDynamicClient

func (k *MockKubectlCmd) NewDynamicClient(config *rest.Config) (dynamic.Interface, error)

func (*MockKubectlCmd) PatchResource

func (k *MockKubectlCmd) PatchResource(ctx context.Context, config *rest.Config, gvk schema.GroupVersionKind, name string, namespace string, patchType types.PatchType, patchBytes []byte, subresources ...string) (*unstructured.Unstructured, error)

func (*MockKubectlCmd) SetOnKubectlRun

func (k *MockKubectlCmd) SetOnKubectlRun(onKubectlRun kube.OnKubectlRunFunc)

func (*MockKubectlCmd) WithConvertToVersionFunc

func (k *MockKubectlCmd) WithConvertToVersionFunc(convertToVersionFunc func(*unstructured.Unstructured, string, string) (*unstructured.Unstructured, error)) *MockKubectlCmd

WithConvertToVersionFunc overrides the default ConvertToVersion behavior.

func (*MockKubectlCmd) WithGetResourceFunc

func (k *MockKubectlCmd) WithGetResourceFunc(getResourcefunc func(context.Context, *rest.Config, schema.GroupVersionKind, string, string) (*unstructured.Unstructured, error)) *MockKubectlCmd

WithGetResourceFunc overrides the default ConvertToVersion behavior.

type MockResourceOps

type MockResourceOps struct {
	Commands      map[string]KubectlOutput
	Events        chan watch.Event
	DynamicClient dynamic.Interface
	// contains filtered or unexported fields
}

func (*MockResourceOps) ApplyResource

func (r *MockResourceOps) ApplyResource(ctx context.Context, obj *unstructured.Unstructured, dryRunStrategy cmdutil.DryRunStrategy, force, validate, serverSideApply bool, manager string) (string, error)

func (*MockResourceOps) CreateResource

func (r *MockResourceOps) CreateResource(ctx context.Context, obj *unstructured.Unstructured, dryRunStrategy cmdutil.DryRunStrategy, validate bool) (string, error)

func (*MockResourceOps) GetLastResourceCommand

func (r *MockResourceOps) GetLastResourceCommand(key kube.ResourceKey) string

func (*MockResourceOps) GetLastServerSideApply

func (r *MockResourceOps) GetLastServerSideApply() bool

func (*MockResourceOps) GetLastServerSideApplyManager

func (r *MockResourceOps) GetLastServerSideApplyManager() string

func (*MockResourceOps) GetLastValidate

func (r *MockResourceOps) GetLastValidate() bool

func (*MockResourceOps) ReplaceResource

func (r *MockResourceOps) ReplaceResource(ctx context.Context, obj *unstructured.Unstructured, dryRunStrategy cmdutil.DryRunStrategy, force bool) (string, error)

func (*MockResourceOps) SetLastResourceCommand

func (r *MockResourceOps) SetLastResourceCommand(key kube.ResourceKey, cmd string)

func (*MockResourceOps) SetLastServerSideApply

func (r *MockResourceOps) SetLastServerSideApply(serverSideApply bool)

func (*MockResourceOps) SetLastServerSideApplyManager

func (r *MockResourceOps) SetLastServerSideApplyManager(manager string)

func (*MockResourceOps) SetLastValidate

func (r *MockResourceOps) SetLastValidate(validate bool)

func (*MockResourceOps) UpdateResource

func (*MockResourceOps) WithGetResourceFunc

WithGetResourceFunc overrides the default ConvertToVersion behavior.

Jump to

Keyboard shortcuts

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