testing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteResources

func DeleteResources(file string, clt client.Client) (err error)

DeleteResources delete resources contained in the file

func LoadKubeResources

func LoadKubeResources(file string, clt client.Client, converts ...ConvertRuntimeObjctToClientObjectFunc) (err error)

LoadKubeResources loading kubernetes resources

func LoadKubeResourcesAsUnstructured

func LoadKubeResourcesAsUnstructured(file string) (objs []unstructured.Unstructured, err error)

func LoadObjectOrDie

func LoadObjectOrDie(g *WithT, file string, obj metav1.Object, patches ...func(metav1.Object)) metav1.Object

LoadObjectOrDie loads object from yaml and returns

func LoadObjectReferenceOrDie

func LoadObjectReferenceOrDie(g *WithT, file string, obj *corev1.ObjectReference, patches ...func(*corev1.ObjectReference)) *corev1.ObjectReference

LoadObjectReferenceOrDie loads object reference from yaml and returns

func LoadResourceFromFile

func LoadResourceFromFile(scheme *runtime.Scheme, path string) (obj runtime.Object, err error)

func LoadResourcesFromFile

func LoadResourcesFromFile(scheme *runtime.Scheme, path string) (objs []runtime.Object, err error)

func LoadYAML

func LoadYAML(file string, obj interface{}) (err error)

LoadYAML loads yaml

func RuntimeObjectFromUnstructured

func RuntimeObjectFromUnstructured(scheme *runtime.Scheme, u *unstructured.Unstructured) (runtime.Object, error)

RuntimeObjectFromUnstructured converts an unstructured to a runtime object

func SetName

func SetName(name string) func(metav1.Object)

func UnstructedToTyped

func UnstructedToTyped(from unstructured.Unstructured, to interface{}) error

UnstructedToTyped converts an unstructured object into a object Warning: This SHOULD never be used in production code, only in test code

func WarningOnError

func WarningOnError(logger *zap.SugaredLogger, err error, message string)

WarningOnError set a warning on error

Types

type ConditionBuilder

type ConditionBuilder struct {
	apis.Condition
}

ConditionBuilder builds a conditions in a builder pattern

func BuildCondition

func BuildCondition() *ConditionBuilder

BuildCondition starts a condition builder object useful for unit tests that require validating multiple conditions

func (*ConditionBuilder) Done

func (c *ConditionBuilder) Done() *apis.Condition

SetReasonMessage returns a condition

func (*ConditionBuilder) SetReasonMessage

func (c *ConditionBuilder) SetReasonMessage(reason, message string, formtKeyValues ...interface{}) *ConditionBuilder

SetReasonMessage sets the message for the condition

func (*ConditionBuilder) SetStatus

SetStatus sets the status for the condition

func (*ConditionBuilder) SetType

SetType sets the type for the condition

type ConvertRuntimeObjctToClientObjectFunc added in v0.3.0

type ConvertRuntimeObjctToClientObjectFunc func(runtime.Object) (client.Object, error)

Directories

Path Synopsis
mock
github.com/katanomi/pkg/apis/meta/v1alpha1
Package apis is a generated GoMock package.
Package apis is a generated GoMock package.
github.com/katanomi/pkg/multicluster
Package multicluster is a generated GoMock package.
Package multicluster is a generated GoMock package.
knative.dev/pkg/apis
Package apis is a generated GoMock package.
Package apis is a generated GoMock package.
sigs.k8s.io/controller-runtime/pkg/manager
Package manager is a generated GoMock package.
Package manager is a generated GoMock package.

Jump to

Keyboard shortcuts

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