testing

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BrokerNamespace    = "test-namespace"
	BrokerName         = "test-broker"
	ConfigMapNamespace = "test-namespace-config-map"
	ConfigMapName      = "test-config-cm"

	ServiceURL = "http://test-service.test-service-namespace.svc.cluster.local/"

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

Variables

View Source
var DefaultConfigs = &broker.Configs{

	EnvConfigs: broker.EnvConfigs{
		DataPlaneConfigMapName:      "kafka-broker-brokers-triggers",
		DataPlaneConfigMapNamespace: "knative-eventing",
		BrokerIngressName:           "kafka-broker-receiver",
		SystemNamespace:             "knative-eventing",
		DataPlaneConfigFormat:       base.Json,
	},

	BootstrapServers: "",
}
View Source
var (
	Formats = []string{base.Protobuf, base.Json}
)

Functions

func Addressable

func Addressable(configs *Configs) func(broker *eventing.Broker)

func BrokerConfig

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

func BrokerReady

func BrokerReady(broker *eventing.Broker)

func ConfigMapUpdate

func ConfigMapUpdate(configs *Configs, brokers *coreconfig.Brokers) clientgotesting.UpdateActionImpl

func ConfigMapUpdatedReady

func ConfigMapUpdatedReady(configs *Configs) func(broker *eventing.Broker)

func ConfigNotParsed

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

func ConfigParsed

func ConfigParsed(broker *eventing.Broker)

func DispatcherPodUpdate

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

func FailedToCreateTopic

func FailedToCreateTopic(broker *eventing.Broker)

func FailedToGetConfigMap

func FailedToGetConfigMap(configs *Configs) func(broker *eventing.Broker)

func GetTopic

func GetTopic() string

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 NewConfigMap

func NewConfigMap(configs *Configs, data []byte) runtime.Object

func NewConfigMapFromBrokers

func NewConfigMapFromBrokers(brokers *coreconfig.Brokers, configs *Configs) runtime.Object

func NewDeletedBroker

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

func NewDispatcherPod

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

func NewFactory

func NewFactory(configs *broker.Configs, ctor Ctor) Factory

func NewReceiverPod

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

func NewService

func NewService() *corev1.Service

func ReceiverPodUpdate

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

func TopicReady

func TopicReady(broker *eventing.Broker)

func WithBrokerConfig

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

func WithDelivery

func WithDelivery() func(*eventing.Broker)

Types

type Ctor

type Ctor func(ctx context.Context, listers *Listers, configs *broker.Configs, row *TableRow) pkgcontroller.Reconciler

Ctor functions create a k8s controller with given params.

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) GetEventingObjects

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

func (*Listers) GetKubeObjects

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

func (*Listers) GetPodLister

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

func (*Listers) GetTriggerLister

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

type MockKafkaClusterAdmin

type MockKafkaClusterAdmin struct {
	// (Create|Delete)Topic
	ExpectedTopicName string

	// CreateTopic
	ExpectedTopicDetail sarama.TopicDetail
	ErrorOnCreateTopic  error

	// DeleteTopic
	ErrorOnDeleteTopic error

	T *testing.T
}

func (MockKafkaClusterAdmin) AlterConfig

func (m MockKafkaClusterAdmin) AlterConfig(resourceType sarama.ConfigResourceType, name string, entries map[string]*string, validateOnly bool) error

func (MockKafkaClusterAdmin) AlterPartitionReassignments

func (m MockKafkaClusterAdmin) AlterPartitionReassignments(topic string, assignment [][]int32) error

func (MockKafkaClusterAdmin) Close

func (m MockKafkaClusterAdmin) Close() error

func (MockKafkaClusterAdmin) CreateACL

func (m MockKafkaClusterAdmin) CreateACL(resource sarama.Resource, acl sarama.Acl) error

func (MockKafkaClusterAdmin) CreatePartitions

func (m MockKafkaClusterAdmin) CreatePartitions(topic string, count int32, assignment [][]int32, validateOnly bool) error

func (MockKafkaClusterAdmin) CreateTopic

func (m MockKafkaClusterAdmin) CreateTopic(topic string, detail *sarama.TopicDetail, validateOnly bool) error

func (MockKafkaClusterAdmin) DeleteACL

func (m MockKafkaClusterAdmin) DeleteACL(filter sarama.AclFilter, validateOnly bool) ([]sarama.MatchingAcl, error)

func (MockKafkaClusterAdmin) DeleteConsumerGroup

func (m MockKafkaClusterAdmin) DeleteConsumerGroup(group string) error

func (MockKafkaClusterAdmin) DeleteRecords

func (m MockKafkaClusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]int64) error

func (MockKafkaClusterAdmin) DeleteTopic

func (m MockKafkaClusterAdmin) DeleteTopic(topic string) error

func (MockKafkaClusterAdmin) DescribeCluster

func (m MockKafkaClusterAdmin) DescribeCluster() (brokers []*sarama.Broker, controllerID int32, err error)

func (MockKafkaClusterAdmin) DescribeConfig

func (m MockKafkaClusterAdmin) DescribeConfig(resource sarama.ConfigResource) ([]sarama.ConfigEntry, error)

func (MockKafkaClusterAdmin) DescribeConsumerGroups

func (m MockKafkaClusterAdmin) DescribeConsumerGroups(groups []string) ([]*sarama.GroupDescription, error)

func (MockKafkaClusterAdmin) DescribeLogDirs

func (m MockKafkaClusterAdmin) DescribeLogDirs(brokers []int32) (map[int32][]sarama.DescribeLogDirsResponseDirMetadata, error)

func (MockKafkaClusterAdmin) DescribeTopics

func (m MockKafkaClusterAdmin) DescribeTopics(topics []string) (metadata []*sarama.TopicMetadata, err error)

func (MockKafkaClusterAdmin) ListAcls

func (MockKafkaClusterAdmin) ListConsumerGroupOffsets

func (m MockKafkaClusterAdmin) ListConsumerGroupOffsets(group string, topicPartitions map[string][]int32) (*sarama.OffsetFetchResponse, error)

func (MockKafkaClusterAdmin) ListConsumerGroups

func (m MockKafkaClusterAdmin) ListConsumerGroups() (map[string]string, error)

func (MockKafkaClusterAdmin) ListPartitionReassignments

func (m MockKafkaClusterAdmin) ListPartitionReassignments(topics string, partitions []int32) (topicStatus map[string]map[int32]*sarama.PartitionReplicaReassignmentsStatus, err error)

func (MockKafkaClusterAdmin) ListTopics

func (m MockKafkaClusterAdmin) ListTopics() (map[string]sarama.TopicDetail, error)

Jump to

Keyboard shortcuts

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