testing

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BrokerUUID      = "e7185016-5d98-4b54-84e8-3b1cd4acc6b4"
	BrokerNamespace = "test-namespace"
	BrokerName      = "test-broker"

	ConfigMapFinalizerName = "kafka.brokers.eventing.knative.dev/" + BrokerNamespace + "-" + BrokerName
)
View Source
const (
	ChannelName             = "kc"
	ChannelNamespace        = "test-nc"
	ChannelUUID             = "c1234567-8901-2345-6789-123456789101"
	ChannelBootstrapServers = "kafka-1:9092,kafka-2:9093"

	Subscription1Name     = "sub-1"
	Subscription2Name     = "sub-2"
	Subscription1UUID     = "2f9b5e8e-deb6-11e8-9f32-f2801f1b9fd1"
	Subscription2UUID     = "34c5aec8-deb6-11e8-9f32-f2801f1b9fd1"
	Subscription1URI      = "sub-1-uri"
	Subscription2URI      = "sub-2-uri"
	Subscription1ReplyURI = "sub-1-reply-uri"
	Subscription2ReplyURI = "sub-2-reply-uri"
)
View Source
const (
	ConfigMapNamespace = "test-namespace-config-map"
	ConfigMapName      = "test-config-cm"

	ServiceNamespace = "test-service-namespace"
	ServiceName      = "test-service"

	TriggerUUID = "e7185016-5d98-4b54-84e8-3b1cd4acc6b5"

	SecretResourceVersion = "1234"
	SecretUUID            = "a7185016-5d98-4b54-84e8-3b1cd4acc6b6"
)
View Source
const (
	SinkUUID      = "e7185016-5d98-4b54-84e8-3b1cd4acc6b5"
	SinkNamespace = "sink-namespace"
	SinkName      = "sink-name"

	SinkNumPartitions     = 10
	SinkReplicationFactor = 3

	SinkNotPresentErrFormat = "failed to describe topics %v: %v"
)
View Source
const (
	SourceName             = "ks"
	SourceNamespace        = "test-ns"
	SourceConsumerGroup    = "ks-group"
	SourceUUID             = "uuid"
	SourceBootstrapServers = "kafka:9092"
)

Variables

View Source
var (
	SourceTopics = []string{"t1", "t2"}
)

Functions

func BootstrapServers added in v0.18.0

func BootstrapServers(bootstrapServers []string) func(obj duckv1.KRShaped)

func BrokerAddressable added in v0.18.0

func BrokerAddressable(env *config.Env) func(broker *eventing.Broker)

func BrokerConfig

func BrokerConfig(bootstrapServers string, numPartitions, replicationFactor int, options ...CMOption) *corev1.ConfigMap

func BrokerDLSResolved added in v0.27.0

func BrokerDLSResolved(uri string) func(broker *eventing.Broker)

func BrokerDispatcherPod added in v0.18.0

func BrokerDispatcherPod(namespace string, annotations map[string]string) runtime.Object

func BrokerDispatcherPodUpdate added in v0.18.0

func BrokerDispatcherPodUpdate(namespace string, annotations map[string]string) clientgotesting.UpdateActionImpl

func BrokerReady

func BrokerReady(broker *eventing.Broker)

func BrokerReceiverPod added in v0.18.0

func BrokerReceiverPod(namespace string, annotations map[string]string) runtime.Object

func BrokerReceiverPodUpdate added in v0.18.0

func BrokerReceiverPodUpdate(namespace string, annotations map[string]string) clientgotesting.UpdateActionImpl

func BrokerTopic added in v0.18.0

func BrokerTopic() string

func ChannelAddressable added in v0.28.0

func ChannelAddressable(env *config.Env) func(obj duckv1.KRShaped)

func ChannelDispatcherPod added in v0.28.0

func ChannelDispatcherPod(namespace string, annotations map[string]string) runtime.Object

func ChannelDispatcherPodUpdate added in v0.28.0

func ChannelDispatcherPodUpdate(namespace string, annotations map[string]string) clientgotesting.UpdateActionImpl

func ChannelReceiverPod added in v0.28.0

func ChannelReceiverPod(namespace string, annotations map[string]string) runtime.Object

func ChannelReceiverPodUpdate added in v0.28.0

func ChannelReceiverPodUpdate(namespace string, annotations map[string]string) clientgotesting.UpdateActionImpl

func ChannelTopic added in v0.28.0

func ChannelTopic() string

func ConfigMapUpdate

func ConfigMapUpdate(env *config.Env, contract *contract.Contract) clientgotesting.UpdateActionImpl

func InitSinkConditions added in v0.18.0

func InitSinkConditions(obj duckv1.KRShaped)

func InitSourceConditions added in v0.28.0

func InitSourceConditions(obj duckv1.KRShaped)

func KReference

func KReference(configMap *corev1.ConfigMap) *duckv1.KReference

func NewBroker

func NewBroker(options ...reconcilertesting.BrokerOption) runtime.Object

NewBroker creates a new Broker with broker class equals to kafka.BrokerClass.

func NewChannel added in v0.28.0

func NewChannel(options ...KRShapedOption) runtime.Object

func NewConfigMapFromContract added in v0.18.0

func NewConfigMapFromContract(contract *contract.Contract, env *config.Env) runtime.Object

func NewConfigMapWithBinaryData added in v0.28.0

func NewConfigMapWithBinaryData(env *config.Env, data []byte) runtime.Object

func NewConfigMapWithTextData added in v0.28.0

func NewConfigMapWithTextData(namespace, name string, data map[string]string) runtime.Object

func NewConsumerGroup added in v0.28.0

func NewConsumerGroup() *internalscg.ConsumerGroup

func NewDeletedBroker

func NewDeletedBroker(options ...reconcilertesting.BrokerOption) runtime.Object

func NewDeletedSink added in v0.18.0

func NewDeletedSink(options ...KRShapedOption) runtime.Object

func NewDeletedSource added in v0.27.0

func NewDeletedSource(options ...KRShapedOption) runtime.Object

func NewFactory

func NewFactory(env *config.Env, ctor Ctor) Factory

func NewSSLSecret added in v0.21.0

func NewSSLSecret(ns, name string) *corev1.Secret

func NewService

func NewService(mutations ...func(*corev1.Service)) *corev1.Service

func NewSink added in v0.18.0

func NewSink(options ...KRShapedOption) runtime.Object

func NewSource added in v0.27.0

func NewSource(options ...KRShapedOption) *sources.KafkaSource

func NewSourceSinkObject added in v0.27.0

func NewSourceSinkObject() *corev1.Service

func NewSourceSinkReference added in v0.27.0

func NewSourceSinkReference() duckv1.Destination

func ServiceURLFrom added in v0.25.2

func ServiceURLFrom(ns, name string) string

func SinkAddressable added in v0.18.0

func SinkAddressable(configs *config.Env) func(obj duckv1.KRShaped)

func SinkAuthSecretRef added in v0.21.0

func SinkAuthSecretRef(name string) func(obj duckv1.KRShaped)

func SinkReceiverPod added in v0.18.0

func SinkReceiverPod(namespace string, annotations map[string]string) runtime.Object

func SinkReceiverPodUpdate added in v0.18.0

func SinkReceiverPodUpdate(namespace string, annotations map[string]string) clientgotesting.UpdateActionImpl

func SinkTopic added in v0.18.0

func SinkTopic() string

func SourceDispatcherPod added in v0.27.0

func SourceDispatcherPod(namespace string, annotations map[string]string) runtime.Object

func StatusBrokerConfigMapUpdatedReady added in v0.28.0

func StatusBrokerConfigMapUpdatedReady(env *config.Env) func(broker *eventing.Broker)

func StatusBrokerConfigNotParsed added in v0.28.0

func StatusBrokerConfigNotParsed(reason string) func(broker *eventing.Broker)

func StatusBrokerConfigParsed added in v0.28.0

func StatusBrokerConfigParsed(broker *eventing.Broker)

func StatusBrokerDataPlaneAvailable added in v0.28.0

func StatusBrokerDataPlaneAvailable(broker *eventing.Broker)

func StatusBrokerDataPlaneNotAvailable added in v0.28.0

func StatusBrokerDataPlaneNotAvailable(broker *eventing.Broker)

func StatusBrokerFailedToCreateTopic added in v0.28.0

func StatusBrokerFailedToCreateTopic(broker *eventing.Broker)

func StatusBrokerProbeFailed added in v0.28.0

func StatusBrokerProbeFailed(status prober.Status) reconcilertesting.BrokerOption

func StatusBrokerProbeSucceeded added in v0.28.0

func StatusBrokerProbeSucceeded(broker *eventing.Broker)

func StatusBrokerTopicReady added in v0.28.0

func StatusBrokerTopicReady(broker *eventing.Broker)

func StatusConfigMapNotUpdatedReady added in v0.28.0

func StatusConfigMapNotUpdatedReady(reason, message string) func(obj duckv1.KRShaped)

func StatusConfigMapUpdatedReady added in v0.28.0

func StatusConfigMapUpdatedReady(env *config.Env) func(obj duckv1.KRShaped)

func StatusConfigNotParsed added in v0.28.0

func StatusConfigNotParsed(reason string) func(obj duckv1.KRShaped)

func StatusConfigParsed added in v0.28.0

func StatusConfigParsed(obj duckv1.KRShaped)

func StatusControllerOwnsTopic added in v0.28.0

func StatusControllerOwnsTopic(topicOwner string) func(obj duckv1.KRShaped)

func StatusDataPlaneAvailable added in v0.28.0

func StatusDataPlaneAvailable(obj duckv1.KRShaped)

func StatusDataPlaneNotAvailable added in v0.28.0

func StatusDataPlaneNotAvailable(obj duckv1.KRShaped)

func StatusFailedToCreateTopic added in v0.28.0

func StatusFailedToCreateTopic(topicName string) func(obj duckv1.KRShaped)

func StatusInitialOffsetsCommitted added in v0.28.0

func StatusInitialOffsetsCommitted(obj duckv1.KRShaped)

func StatusProbeFailed added in v0.28.0

func StatusProbeFailed(status prober.Status) func(obj duckv1.KRShaped)

func StatusProbeSucceeded added in v0.28.0

func StatusProbeSucceeded(obj duckv1.KRShaped)

func StatusTopicNotPresentErr added in v0.28.0

func StatusTopicNotPresentErr(topic string, err error) func(obj duckv1.KRShaped)

func StatusTopicReadyWithName added in v0.28.0

func StatusTopicReadyWithName(topic string) func(obj duckv1.KRShaped)

func StatusTopicReadyWithOwner added in v0.28.0

func StatusTopicReadyWithOwner(topic, owner string) func(obj duckv1.KRShaped)

func ToUnstructured added in v0.18.0

func ToUnstructured(t *testing.T, objs []runtime.Object) (us []runtime.Object)

ToUnstructured takes a list of k8s resources and converts them to Unstructured objects. We must pass objects as Unstructured to the dynamic client fake, or it won't handle them properly.

func WithBrokerConfig

func WithBrokerConfig(reference *duckv1.KReference) func(*eventing.Broker)

func WithDeletedTimeStamp added in v0.28.0

func WithDeletedTimeStamp(obj duckv1.KRShaped)

func WithDelivery

func WithDelivery(mutations ...func(spec *eventingduck.DeliverySpec)) func(*eventing.Broker)

func WithFreshSubscriber added in v0.28.0

func WithFreshSubscriber(sub *SubscriberInfo)

func WithInitKafkaChannelConditions added in v0.28.0

func WithInitKafkaChannelConditions(obj duckv1.KRShaped)

func WithNoDeadLetterSinkNamespace added in v0.25.2

func WithNoDeadLetterSinkNamespace(spec *eventingduck.DeliverySpec)

func WithRetry added in v0.19.0

func WithRetry(retry *int32, policy *eventingduck.BackoffPolicyType, delay *string) func(*eventing.Broker)

func WithServiceNamespace added in v0.25.2

func WithServiceNamespace(ns string) func(s *corev1.Service)

func WithSubscribers added in v0.28.0

func WithSubscribers(subscribers ...*SubscriberInfo) func(obj duckv1.KRShaped)

func WithUnreadySubscriber added in v0.28.0

func WithUnreadySubscriber(sub *SubscriberInfo)

Types

type CMOption added in v0.21.0

type CMOption func(cm *corev1.ConfigMap)

func BrokerAuthConfig added in v0.21.0

func BrokerAuthConfig(name string) CMOption

func BrokerConfigFinalizer added in v0.28.0

func BrokerConfigFinalizer(finalizerName string) CMOption

func BrokerConfigFinalizerRemove added in v0.28.0

func BrokerConfigFinalizerRemove(finalizerName string) CMOption

type Ctor

type Ctor func(ctx context.Context, listers *Listers, env *config.Env, row *TableRow) pkgcontroller.Reconciler

Ctor functions create a k8s controller with given params.

type KRShapedOption added in v0.28.0

type KRShapedOption func(obj duckv1.KRShaped)

func StatusSourceSinkNotResolved added in v0.28.0

func StatusSourceSinkNotResolved(err string) KRShapedOption

func StatusSourceSinkResolved added in v0.28.0

func StatusSourceSinkResolved(uri string) KRShapedOption

func WithCloudEventOverrides added in v0.27.0

func WithCloudEventOverrides(overrides *duckv1.CloudEventOverrides) KRShapedOption

func WithKeyType added in v0.27.0

func WithKeyType(keyType string) KRShapedOption

func WithNumPartitions added in v0.28.0

func WithNumPartitions(np int32) KRShapedOption

func WithReplicationFactor added in v0.28.0

func WithReplicationFactor(rp int16) KRShapedOption

func WithRetentionDuration added in v0.28.0

func WithRetentionDuration(rd string) KRShapedOption

type Listers

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

func (*Listers) GetAllObjects

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

func (*Listers) GetBrokerLister

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

func (*Listers) GetConfigMapLister

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

func (*Listers) GetConsumerGroupLister added in v0.28.0

func (l *Listers) GetConsumerGroupLister() consumerlisters.ConsumerGroupLister

func (*Listers) GetConsumerGroupObjects added in v0.28.0

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

func (*Listers) GetConsumerLister added in v0.28.0

func (l *Listers) GetConsumerLister() consumerlisters.ConsumerLister

func (*Listers) GetConsumerObjects added in v0.28.0

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

func (*Listers) GetEventingKafkaBrokerObjects added in v0.27.0

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

func (*Listers) GetEventingKafkaObjects added in v0.18.0

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

func (*Listers) GetEventingObjects

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

func (*Listers) GetKafkaChannelLister added in v0.28.0

func (l *Listers) GetKafkaChannelLister() eventingkafkachannelslisters.KafkaChannelLister

func (*Listers) GetKafkaSinkLister added in v0.18.0

func (l *Listers) GetKafkaSinkLister() eventingkafkabrokerlisters.KafkaSinkLister

func (*Listers) GetKafkaSourceLister added in v0.27.0

func (l *Listers) GetKafkaSourceLister() eventingkafkasourceslisters.KafkaSourceLister

func (*Listers) GetKubeObjects

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

func (*Listers) GetPodLister

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

func (*Listers) GetSecretLister added in v0.21.0

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

func (*Listers) GetTriggerLister

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

type SubscriberInfo added in v0.28.0

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

func Subscriber1 added in v0.28.0

func Subscriber1(options ...subscriberInfoOption) *SubscriberInfo

func Subscriber2 added in v0.28.0

func Subscriber2(options ...subscriberInfoOption) *SubscriberInfo

Jump to

Keyboard shortcuts

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