testing

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource

func CreateResource(name string) *pkgtest.Resource

CreateResource creates a testing.Resource with the given name in the system namespace.

func ExpectAllowed

func ExpectAllowed(t *testing.T, resp *admissionv1.AdmissionResponse)

ExpectAllowed checks that a given admission response allows the initiating request through.

func ExpectFailsWith

func ExpectFailsWith(t *testing.T, resp *admissionv1.AdmissionResponse, contains string)

ExpectFailsWith checks that a given admission response disallows the initiating request through and contains the provided string in its error message.

func ExpectPatches

func ExpectPatches(t *testing.T, a []byte, e []jsonpatch.JsonPatchOperation)

ExpectPatches checks that the provided serialized bytes consist of an expected collection of patches. This is used to verify the mutations made in a mutating admission webhook's response.

func MakeFactory

func MakeFactory(ctor Ctor) rtesting.Factory

MakeFactory creates a reconciler factory with fake clients and controller created by `ctor`.

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme constructs a scheme from the set of client schemes supported by this package.

Types

type Ctor

Ctor functions create a k8s controller with given params.

type Listers

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

Listers is used to synthesize informer-style Listers from fixed lists of resources in tests.

func NewListers

func NewListers(objs []runtime.Object) Listers

NewListers constructs a Listers from a collection of objects.

func (*Listers) GetAPIExtensionsObjects

func (l *Listers) GetAPIExtensionsObjects() []runtime.Object

GetAPIExtensionsObjects filters the Listers initial list of objects to types definite in k8s.io/apiextensions

func (*Listers) GetConfigMapLister

func (l *Listers) GetConfigMapLister() corev1listers.ConfigMapLister

GetConfigMapLister gets lister for K8s ConfigMap resource.

func (*Listers) GetCustomResourceDefinitionLister

func (l *Listers) GetCustomResourceDefinitionLister() apixlisters.CustomResourceDefinitionLister

func (*Listers) GetDeploymentLister

func (l *Listers) GetDeploymentLister() appsv1listers.DeploymentLister

GetDeploymentLister gets lister for K8s Deployment resource.

func (*Listers) GetDuckObjects

func (l *Listers) GetDuckObjects() []runtime.Object

GetDuckObjects filters the Listers initial list of objects to types defined in knative/pkg

func (*Listers) GetEndpointsLister

func (l *Listers) GetEndpointsLister() corev1listers.EndpointsLister

GetEndpointsLister gets lister for K8s Endpoints resource.

func (*Listers) GetHorizontalPodAutoscalerLister

func (l *Listers) GetHorizontalPodAutoscalerLister() autoscalingv2beta1listers.HorizontalPodAutoscalerLister

GetHorizontalPodAutoscalerLister gets lister for HorizontalPodAutoscaler resources.

func (*Listers) GetK8sServiceLister

func (l *Listers) GetK8sServiceLister() corev1listers.ServiceLister

GetK8sServiceLister gets lister for K8s Service resource.

func (*Listers) GetKubeObjects

func (l *Listers) GetKubeObjects() []runtime.Object

GetKubeObjects filters the Listers initial list of objects to built-in types

func (*Listers) GetMutatingWebhookConfigurationLister

func (l *Listers) GetMutatingWebhookConfigurationLister() admissionlisters.MutatingWebhookConfigurationLister

GetMutatingWebhookConfigurationLister gets lister for K8s MutatingWebhookConfiguration resource.

func (*Listers) GetNamespaceLister

func (l *Listers) GetNamespaceLister() corev1listers.NamespaceLister

GetNamespaceLister gets lister for Namespace resource.

func (*Listers) GetSecretLister

func (l *Listers) GetSecretLister() corev1listers.SecretLister

GetSecretLister gets lister for K8s Secret resource.

func (*Listers) GetTestObjects

func (l *Listers) GetTestObjects() []runtime.Object

GetTestObjects filters the Lister's initial list of objects to types defined in knative/pkg/testing

func (*Listers) GetValidatingWebhookConfigurationLister

func (l *Listers) GetValidatingWebhookConfigurationLister() admissionlisters.ValidatingWebhookConfigurationLister

GetValidatingWebhookConfigurationLister gets lister for K8s ValidatingWebhookConfiguration resource.

func (*Listers) IndexerFor

func (l *Listers) IndexerFor(obj runtime.Object) cache.Indexer

IndexerFor returns the indexer for the given object.

func (*Listers) NewScheme

func (*Listers) NewScheme() *runtime.Scheme

NewScheme constructs a scheme from the set of client schemes supported by this lister.

Jump to

Keyboard shortcuts

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