testing

package
v0.0.0-...-d19fc40 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 70 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoopIAMPolicyManager iam.IAMPolicyManager = noopManager(struct{}{})

Functions

func ApiVersion

func ApiVersion(gvk metav1.GroupVersionKind) string

func AvailableEndpoints

func AvailableEndpoints() *corev1.Endpoints

func InjectPubsubClient

func InjectPubsubClient(td map[string]interface{}, c *pubsub.Client)

func MakeFactory

func MakeFactory(ctor Ctor) Factory

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

func NewBroker

func NewBroker(name, namespace string, o ...BrokerOption) *brokerv1beta1.Broker

NewBroker creates a Broker with BrokerOptions. The Broker has the brokerv1beta1 broker class by default.

func NewBrokerCell

func NewBrokerCell(name, namespace string, o ...BrokerCellOption) *intv1alpha1.BrokerCell

NewBrokerCell creates a BrokerCell with BrokerCellOptions.

func NewChannel

func NewChannel(name, namespace string, so ...ChannelOption) *v1beta1.Channel

NewChannel creates a Channel with ChannelOptions

func NewChannelWithoutNamespace

func NewChannelWithoutNamespace(name string, co ...ChannelOption) *v1beta1.Channel

NewChannelWithoutNamespace creates a Channel with ChannelOptions but without a specific namespace

func NewConfigMap

func NewConfigMap(name, namespace string, cmo ...ConfigMapOption) *corev1.ConfigMap

NewConfigMap creates a ConfigMap with ConfigMapOptions.

func NewDataresidencyConfigMapFromRegions

func NewDataresidencyConfigMapFromRegions(regions []string) *corev1.ConfigMap

NewDataresidencyConfigMapFromRegions Create new data residency configuration map from list of allowed persistence regions

func NewDataresidencyTestStore

func NewDataresidencyTestStore(t *testing.T, config *corev1.ConfigMap) *dataresidency.Store

func NewDeployment

func NewDeployment(name, namespace string, do ...DeploymentOption) *appsv1.Deployment

NewDeployment creates a Deployment with DeploymentOptions.

func NewEndpoints

func NewEndpoints(name, namespace string, so ...EndpointsOption) *corev1.Endpoints

NewEndpoints creates a Endpoints with EndpointsOptions

func NewGCPAuthTestStore

func NewGCPAuthTestStore(t *testing.T, config *corev1.ConfigMap) *gcpauth.Store

func NewNamespace

func NewNamespace(name string, o ...NamespaceOption) *corev1.Namespace

NewNamespace creates a Namespace with NamespaceOptions

func NewService

func NewService(name, namespace string, so ...ServiceOption) *corev1.Service

NewService creates a Service with ServiceOptions

func NewServiceAccount

func NewServiceAccount(name, namespace, gServiceAccount string, so ...ServiceAccountOption) *corev1.ServiceAccount

NewServiceAccount creates a ServiceAccount

func NewTrigger

func NewTrigger(name, namespace, broker string, to ...TriggerOption) *brokerv1beta1.Trigger

NewTrigger creates a Trigger with TriggerOptions.

func NewUnstructured

func NewUnstructured(gvk metav1.GroupVersionKind, name, namespace string, uo ...UnstructuredOption) *unstructured.Unstructured

NewUnstructured creates a unstructured.Unstructured with UnstructuredOption

func NoSubscriptionsExist

func NoSubscriptionsExist() func(*testing.T, *rtesting.TableRow)

func NoTopicsExist

func NoTopicsExist() func(*testing.T, *rtesting.TableRow)

func OnlySubscriptions

func OnlySubscriptions(ids ...string) func(*testing.T, *rtesting.TableRow)

func OnlyTopics

func OnlyTopics(ids ...string) func(*testing.T, *rtesting.TableRow)

func SubscriptionExists

func SubscriptionExists(id string) func(*testing.T, *rtesting.TableRow)

func SubscriptionHasDeadLetterPolicy

func SubscriptionHasDeadLetterPolicy(id string, wantPolicy *pubsub.DeadLetterPolicy) func(*testing.T, *rtesting.TableRow)

func SubscriptionHasRetryPolicy

func SubscriptionHasRetryPolicy(id string, wantPolicy *pubsub.RetryPolicy) func(*testing.T, *rtesting.TableRow)

func TestPubsubClient

func TestPubsubClient(ctx context.Context, projectID string) (*pubsub.Client, func())

func TopicExists

func TopicExists(id string) func(*testing.T, *rtesting.TableRow)

func TopicExistsWithConfig

func TopicExistsWithConfig(id string, expectedTopicConfig *pubsub.TopicConfig) func(*testing.T, *rtesting.TableRow)

func WithBrokerBrokerCellReady

func WithBrokerBrokerCellReady(b *brokerv1beta1.Broker)

func WithBrokerCellDeletionTimestamp

func WithBrokerCellDeletionTimestamp(bc *intv1alpha1.BrokerCell)

func WithBrokerCellReady

func WithBrokerCellReady(bc *intv1alpha1.BrokerCell)

func WithBrokerCellSetDefaults

func WithBrokerCellSetDefaults(bc *intv1alpha1.BrokerCell)

func WithBrokerDeletionTimestamp

func WithBrokerDeletionTimestamp(b *brokerv1beta1.Broker)

func WithBrokerSetDefaults

func WithBrokerSetDefaults(b *brokerv1beta1.Broker)

func WithBrokerSubscriptionReady

func WithBrokerSubscriptionReady(b *brokerv1beta1.Broker)

func WithBrokerTopicReady

func WithBrokerTopicReady(b *brokerv1beta1.Broker)

func WithChannelDeleted

func WithChannelDeleted(s *v1beta1.Channel)

func WithChannelDeletionTimestamp

func WithChannelDeletionTimestamp(c *v1beta1.Channel)

func WithChannelSetDefaults

func WithChannelSetDefaults(c *v1beta1.Channel)

func WithInitBrokerCellConditions

func WithInitBrokerCellConditions(bc *intv1alpha1.BrokerCell)

WithInitBrokerCellConditions initializes the BrokerCell's conditions.

func WithInitBrokerConditions

func WithInitBrokerConditions(b *brokerv1beta1.Broker)

WithInitBrokerConditions initializes the Broker's conditions.

func WithInitChannelConditions

func WithInitChannelConditions(c *v1beta1.Channel)

WithInitChannelConditions initializes the Channels's conditions.

func WithInitTriggerConditions

func WithInitTriggerConditions(t *brokerv1beta1.Trigger)

WithInitTriggerConditions initializes the Triggers's conditions.

func WithNamespaceDeleted

func WithNamespaceDeleted(n *corev1.Namespace)

func WithTriggerBrokerReady

func WithTriggerBrokerReady(t *brokerv1beta1.Trigger)

WithTriggerBrokerReady initializes the Triggers's conditions as if its Broker were ready.

func WithTriggerDeletionTimestamp

func WithTriggerDeletionTimestamp(t *brokerv1beta1.Trigger)

func WithTriggerDependencyReady

func WithTriggerDependencyReady(t *brokerv1beta1.Trigger)

func WithTriggerSetDefaults

func WithTriggerSetDefaults(t *brokerv1beta1.Trigger)

func WithTriggerSubscriberResolvedSucceeded

func WithTriggerSubscriberResolvedSucceeded(t *brokerv1beta1.Trigger)

func WithTriggerSubscriptionReady

func WithTriggerSubscriptionReady(t *brokerv1beta1.Trigger)

func WithTriggerTopicReady

func WithTriggerTopicReady(t *brokerv1beta1.Trigger)

Types

type BrokerCellOption

type BrokerCellOption func(*intv1alpha1.BrokerCell)

BrokerCellOption enables further configuration of a BrokerCell.

func WithBrokerCellAnnotations

func WithBrokerCellAnnotations(annotations map[string]string) BrokerCellOption

func WithBrokerCellFanoutAvailable

func WithBrokerCellFanoutAvailable() BrokerCellOption

func WithBrokerCellFanoutFailed

func WithBrokerCellFanoutFailed(reason, msg string) BrokerCellOption

func WithBrokerCellFanoutUnknown

func WithBrokerCellFanoutUnknown(reason, msg string) BrokerCellOption

func WithBrokerCellFinalizers

func WithBrokerCellFinalizers(finalizers ...string) BrokerCellOption

func WithBrokerCellGeneration

func WithBrokerCellGeneration(gen int64) BrokerCellOption

func WithBrokerCellIngressAvailable

func WithBrokerCellIngressAvailable() BrokerCellOption

func WithBrokerCellIngressFailed

func WithBrokerCellIngressFailed(reason, msg string) BrokerCellOption

func WithBrokerCellRetryAvailable

func WithBrokerCellRetryAvailable() BrokerCellOption

func WithBrokerCellRetryFailed

func WithBrokerCellRetryFailed(reason, msg string) BrokerCellOption

func WithBrokerCellRetryUnknown

func WithBrokerCellRetryUnknown(reason, msg string) BrokerCellOption

func WithBrokerCellStatusObservedGeneration

func WithBrokerCellStatusObservedGeneration(gen int64) BrokerCellOption

func WithIngressTemplate

func WithIngressTemplate(address string) BrokerCellOption

func WithTargetsCofigFailed

func WithTargetsCofigFailed(reason, msg string) BrokerCellOption

func WithTargetsCofigReady

func WithTargetsCofigReady() BrokerCellOption

type BrokerOption

type BrokerOption func(*brokerv1beta1.Broker)

BrokerOption enables further configuration of a Broker.

func WithBrokerAddress

func WithBrokerAddress(address string) BrokerOption

WithBrokerAddress sets the Broker's address.

func WithBrokerAddressURI

func WithBrokerAddressURI(uri *apis.URL) BrokerOption

WithBrokerAddressURI sets the Broker's address as URI.

func WithBrokerBrokerCellFailed

func WithBrokerBrokerCellFailed(reason, msg string) BrokerOption

func WithBrokerBrokerCellUnknown

func WithBrokerBrokerCellUnknown(reason, msg string) BrokerOption

func WithBrokerClass

func WithBrokerClass(bc string) BrokerOption

func WithBrokerDeliverySpec

func WithBrokerDeliverySpec(deliverySpec *eventingduckv1beta1.DeliverySpec) BrokerOption

WithBrokerDeliverySpec sets the Broker's delivery spec.

func WithBrokerFinalizers

func WithBrokerFinalizers(finalizers ...string) BrokerOption

func WithBrokerGeneration

func WithBrokerGeneration(gen int64) BrokerOption

func WithBrokerReady

func WithBrokerReady(address string) BrokerOption

func WithBrokerReadyURI

func WithBrokerReadyURI(address *apis.URL) BrokerOption

WithBrokerReadyURI is a convenience function that sets all ready conditions to true.

func WithBrokerResourceVersion

func WithBrokerResourceVersion(rv string) BrokerOption

func WithBrokerStatusObservedGeneration

func WithBrokerStatusObservedGeneration(gen int64) BrokerOption

func WithBrokerUID

func WithBrokerUID(uid string) BrokerOption

type ChannelOption

type ChannelOption func(*v1beta1.Channel)

ChannelOption enables further configuration of a Channel.

func WithChannelAddress

func WithChannelAddress(url string) ChannelOption

func WithChannelAnnotations

func WithChannelAnnotations(Annotations map[string]string) ChannelOption

func WithChannelGenerateName

func WithChannelGenerateName(generateName string) ChannelOption

func WithChannelLabels

func WithChannelLabels(labels map[string]string) ChannelOption

func WithChannelOwnerReferences

func WithChannelOwnerReferences(ownerReferences []metav1.OwnerReference) ChannelOption

func WithChannelReady

func WithChannelReady(topicID string) ChannelOption

func WithChannelServiceAccount

func WithChannelServiceAccount(kServiceAccount string) ChannelOption

func WithChannelSpec

func WithChannelSpec(spec v1beta1.ChannelSpec) ChannelOption

func WithChannelSubscribers

func WithChannelSubscribers(subscribers []duckv1beta1.SubscriberSpec) ChannelOption

func WithChannelSubscribersStatus

func WithChannelSubscribersStatus(subscribers []eventingduckv1beta1.SubscriberStatus) ChannelOption

func WithChannelTopic

func WithChannelTopic(topicID string) ChannelOption

func WithChannelTopicFailed

func WithChannelTopicFailed(reason, message string) ChannelOption

func WithChannelTopicID

func WithChannelTopicID(topicID string) ChannelOption

func WithChannelTopicUnknown

func WithChannelTopicUnknown(reason, message string) ChannelOption

func WithChannelUID

func WithChannelUID(uid types.UID) ChannelOption

func WithChannelWorkloadIdentityFailed

func WithChannelWorkloadIdentityFailed(reason, message string) ChannelOption

type ConfigMapOption

type ConfigMapOption func(*corev1.ConfigMap)

ConfigMapOption enables further configuration of a ConfigMap.

func WithConfigMapBinaryData

func WithConfigMapBinaryData(data map[string][]byte) ConfigMapOption

func WithConfigMapBinaryDataEntry

func WithConfigMapBinaryDataEntry(key string, value []byte) ConfigMapOption

func WithConfigMapData

func WithConfigMapData(data map[string]string) ConfigMapOption

func WithConfigMapDataEntry

func WithConfigMapDataEntry(key, value string) ConfigMapOption

type Ctor

type Ctor func(context.Context, *Listers, configmap.Watcher, map[string]interface{}) controller.Reconciler

Ctor functions create a k8s controller with given params.

type DeploymentOption

type DeploymentOption func(*appsv1.Deployment)

DeploymentOption enables further configuration of a Deployment.

func WithDeploymentAnnotations

func WithDeploymentAnnotations(annotations map[string]string) DeploymentOption

func WithDeploymentAvailable

func WithDeploymentAvailable() DeploymentOption

WithDeploymentAvailable marks the Deployment as available.

func WithDeploymentContainer

func WithDeploymentContainer(name, image string, envVars []corev1.EnvVar, containerPorts []corev1.ContainerPort) DeploymentOption

func WithDeploymentLabels

func WithDeploymentLabels(labels map[string]string) DeploymentOption

func WithDeploymentOwnerReferences

func WithDeploymentOwnerReferences(ownerReferences []metav1.OwnerReference) DeploymentOption

func WithDeploymentServiceAccount

func WithDeploymentServiceAccount(serviceAccountName string) DeploymentOption

type EndpointsOption

type EndpointsOption func(*corev1.Endpoints)

EndpointsOption enables further configuration of a Endpoints.

func WithEndpointsAddresses

func WithEndpointsAddresses(addrs ...corev1.EndpointAddress) EndpointsOption

func WithEndpointsAnnotations

func WithEndpointsAnnotations(annotations map[string]string) EndpointsOption

func WithEndpointsLabels

func WithEndpointsLabels(labels map[string]string) EndpointsOption

func WithEndpointsNotReadyAddresses

func WithEndpointsNotReadyAddresses(addrs ...corev1.EndpointAddress) EndpointsOption

type Listers

type Listers struct {
	servingv1alpha1listers.ConfigurationLister
	// contains filtered or unexported fields
}

func NewListers

func NewListers(objs []runtime.Object) Listers

func (*Listers) GetAllObjects

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

func (*Listers) GetBrokerCellLister

func (l *Listers) GetBrokerCellLister() intlisters.BrokerCellLister

func (*Listers) GetBrokerLister

func (l *Listers) GetBrokerLister() brokerlisters.BrokerLister

func (*Listers) GetChannelLister

func (l *Listers) GetChannelLister() messaginglisters.ChannelLister

func (*Listers) GetCloudAuditLogsSourceLister

func (l *Listers) GetCloudAuditLogsSourceLister() eventslisters.CloudAuditLogsSourceLister

func (*Listers) GetCloudBuildSourceLister

func (l *Listers) GetCloudBuildSourceLister() eventslisters.CloudBuildSourceLister

func (*Listers) GetCloudPubSubSourceLister

func (l *Listers) GetCloudPubSubSourceLister() eventslisters.CloudPubSubSourceLister

func (*Listers) GetCloudSchedulerSourceLister

func (l *Listers) GetCloudSchedulerSourceLister() eventslisters.CloudSchedulerSourceLister

func (*Listers) GetCloudStorageSourceLister

func (l *Listers) GetCloudStorageSourceLister() eventslisters.CloudStorageSourceLister

func (*Listers) GetConfigMapLister

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

func (*Listers) GetDeploymentLister

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

func (*Listers) GetEndpointsLister

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

func (*Listers) GetEventsObjects

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

func (*Listers) GetHPALister

func (*Listers) GetJobLister

func (l *Listers) GetJobLister() batchv1listers.JobLister

func (*Listers) GetK8sServiceLister

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

func (*Listers) GetKubeObjects

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

func (*Listers) GetNamespaceLister

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

func (*Listers) GetPodLister

func (l *Listers) GetPodLister() corev1listers.PodLister

func (*Listers) GetPullSubscriptionLister

func (l *Listers) GetPullSubscriptionLister() inteventslisters.PullSubscriptionLister

func (*Listers) GetRoleBindingLister

func (l *Listers) GetRoleBindingLister() rbacv1listers.RoleBindingLister

func (*Listers) GetServiceAccountLister

func (l *Listers) GetServiceAccountLister() corev1listers.ServiceAccountLister

func (*Listers) GetServingObjects

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

func (*Listers) GetSinkObjects

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

func (*Listers) GetTopicLister

func (l *Listers) GetTopicLister() inteventslisters.TopicLister

func (*Listers) GetTriggerLister

func (l *Listers) GetTriggerLister() brokerlisters.TriggerLister

func (*Listers) GetV1ServiceLister

func (l *Listers) GetV1ServiceLister() servingv1listers.ServiceLister

func (*Listers) GetV1alpha1ServiceLister

func (l *Listers) GetV1alpha1ServiceLister() servingv1alpha1listers.ServiceLister

func (*Listers) GetV1beta1ServiceLister

func (l *Listers) GetV1beta1ServiceLister() servingv1beta1listers.ServiceLister

func (*Listers) GetV1beta1TopicLister

func (l *Listers) GetV1beta1TopicLister() inteventsv1beta1listers.TopicLister

type NamespaceOption

type NamespaceOption func(*corev1.Namespace)

NamespaceOption enables further configuration of a Namespace.

func WithNamespaceLabeled

func WithNamespaceLabeled(labels map[string]string) NamespaceOption

type PubsubAction

type PubsubAction func(context.Context, *testing.T, *pubsub.Client)

func SubscriptionWithTopic

func SubscriptionWithTopic(id string, tid string) PubsubAction

func Topic

func Topic(id string) PubsubAction

func TopicAndSub

func TopicAndSub(tid, sid string) PubsubAction

type ServiceAccountOption

type ServiceAccountOption func(*corev1.ServiceAccount)

func WithServiceAccountOwnerReferences

func WithServiceAccountOwnerReferences(ownerReferences []metav1.OwnerReference) ServiceAccountOption

type ServiceOption

type ServiceOption func(*corev1.Service)

ServiceOption enables further configuration of a Service.

func WithServiceLabels

func WithServiceLabels(labels map[string]string) ServiceOption

func WithServiceOwnerReferences

func WithServiceOwnerReferences(ownerReferences []metav1.OwnerReference) ServiceOption

func WithServicePorts

func WithServicePorts(ports []corev1.ServicePort) ServiceOption

type TriggerOption

type TriggerOption func(*brokerv1beta1.Trigger)

TriggerOption enables further configuration of a Trigger.

func WithDependencyAnnotation

func WithDependencyAnnotation(dependencyAnnotation string) TriggerOption

func WithInjectionAnnotation

func WithInjectionAnnotation(injectionAnnotation string) TriggerOption

func WithTriggerBrokerFailed

func WithTriggerBrokerFailed(reason, message string) TriggerOption

WithTriggerBrokerFailed marks the Broker as failed

func WithTriggerBrokerUnknown

func WithTriggerBrokerUnknown(reason, message string) TriggerOption

WithTriggerBrokerUnknown marks the Broker as unknown

func WithTriggerDependencyFailed

func WithTriggerDependencyFailed(reason, message string) TriggerOption

func WithTriggerDependencyUnknown

func WithTriggerDependencyUnknown(reason, message string) TriggerOption

func WithTriggerFinalizers

func WithTriggerFinalizers(finalizers ...string) TriggerOption

func WithTriggerGeneration

func WithTriggerGeneration(gen int64) TriggerOption

func WithTriggerStatusObservedGeneration

func WithTriggerStatusObservedGeneration(gen int64) TriggerOption

func WithTriggerStatusSubscriberURI

func WithTriggerStatusSubscriberURI(uri string) TriggerOption

func WithTriggerSubscriberRef

func WithTriggerSubscriberRef(gvk metav1.GroupVersionKind, name, namespace string) TriggerOption

func WithTriggerSubscriberRefAndURIReference

func WithTriggerSubscriberRefAndURIReference(gvk metav1.GroupVersionKind, name, namespace string, rawuri string) TriggerOption

func WithTriggerSubscriberResolvedFailed

func WithTriggerSubscriberResolvedFailed(reason, message string) TriggerOption

func WithTriggerSubscriberResolvedUnknown

func WithTriggerSubscriberResolvedUnknown(reason, message string) TriggerOption

func WithTriggerSubscriberURI

func WithTriggerSubscriberURI(rawurl string) TriggerOption

func WithTriggerUID

func WithTriggerUID(uid string) TriggerOption

type UnstructuredOption

type UnstructuredOption func(*unstructured.Unstructured)

UnstructuredOption enables further configuration of a Unstructured.

func WithUnstructuredAddressable

func WithUnstructuredAddressable(hostname string) UnstructuredOption

func WithUnstructuredAnnotations

func WithUnstructuredAnnotations(annotations map[string]interface{}) UnstructuredOption

func WithUnstructuredLabels

func WithUnstructuredLabels(labels map[string]interface{}) UnstructuredOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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