testing

package
v0.29.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SystemNamespace = "eventing-test-ns"
	SecretName      = "test-secret-name"

	NewClientId = "TestNewClientId"
	OldUsername = "TestOldUsername"
	NewUsername = "TestNewUsername"
	OldPassword = "TestOldPassword"
	NewPassword = "TestNewPassword"

	ReceiverCpuLimit        = "501m"
	ReceiverCpuRequest      = "301m"
	ReceiverMemoryLimit     = "129Mi"
	ReceiverMemoryRequest   = "51Mi"
	ReceiverReplicas        = "4"
	DispatcherReplicas      = "3"
	DispatcherCpuLimit      = "500m"
	DispatcherCpuRequest    = "300m"
	DispatcherMemoryLimit   = "128Mi"
	DispatcherMemoryRequest = "50Mi"
	BrokerString            = "test-broker-string"

	TestEKConfig = `
channel:
  adminType: kafka # One of "kafka", "azure", "custom"
  receiver:
    cpuRequest: ` + ReceiverCpuRequest + `
    memoryRequest: ` + ReceiverMemoryRequest + `
    cpuLimit: ` + ReceiverCpuLimit + `
    memoryLimit: ` + ReceiverMemoryLimit + `
    replicas: ` + ReceiverReplicas + `
  dispatcher:
    cpuRequest: ` + DispatcherCpuRequest + `
    memoryRequest: ` + DispatcherMemoryRequest + `
    cpuLimit: ` + DispatcherCpuLimit + `
    memoryLimit: ` + DispatcherMemoryLimit + `
    replicas: ` + DispatcherReplicas + `
kafka:
  brokers: ` + BrokerString + `
`

	OldSaramaConfig = `
enableLogging: false
config: |
  Net:
    TLS:
      Enable: true
    SASL:
      Enable: true
      Mechanism: PLAIN
      Version: 1
      User: ` + OldUsername + `
      Password: ` + OldPassword + `
  Metadata:
    RefreshFrequency: 300000000000
`

	NewSaramaConfig = `
enableLogging: false
config: |
  Version: 2.3.0
  Net:
    TLS:
      Enable: true
    SASL:
      Enable: true
      Mechanism: PLAIN
      Version: 1
      User: ` + NewUsername + `
      Password: ` + NewPassword + `
  Metadata:
    RefreshFrequency: 300000000000
  ClientID: ` + NewClientId + `
`

	OldAuthNamespace = "TestOldNamespace"
	OldAuthPassword  = "TestOldPassword"
	OldAuthSaslType  = "TestOldAuthSaslType"
	OldAuthUsername  = "TestOldAuthUsername"

	NewAuthNamespace = "TestNewNamespace"
	NewAuthPassword  = "TestNewPassword"
	NewAuthSaslType  = "TestNewAuthSaslType"
	NewAuthUsername  = "TestNewAuthUsername"
)

Variables

This section is empty.

Functions

func GetTestSaramaConfigMap

func GetTestSaramaConfigMap(version string, saramaConfig string, configuration string) *corev1.ConfigMap

GetTestSaramaConfigMap Returns A ConfigMap Containing The Desired Sarama Config YAML

func GetTestSaramaConfigMapNamespaced

func GetTestSaramaConfigMapNamespaced(version, name, namespace, saramaConfig, configuration string) *corev1.ConfigMap

GetTestSaramaConfigMapNamespaced Returns A ConfigMap Containing The Desired Sarama Config YAML, Name And Namespace

func GetTestSaramaSecret

func GetTestSaramaSecret(name string, username string, password string, namespace string, saslType string) *corev1.Secret

GetTestSaramaSecret Returns A Secret Containing The Desired Fields

func SetTestEnvironment

func SetTestEnvironment(t *testing.T)

SetTestEnvironment Sets the environment variables that are necessary for common components

Types

type MockClusterAdmin added in v0.24.6

type MockClusterAdmin struct {
	MockCreateTopicFunc        func(topic string, detail *sarama.TopicDetail, validateOnly bool) error
	MockDeleteTopicFunc        func(topic string) error
	MockListConsumerGroupsFunc func() (map[string]string, error)
}

func (*MockClusterAdmin) AlterClientQuotas added in v0.28.0

func (ca *MockClusterAdmin) AlterClientQuotas(entity []sarama.QuotaEntityComponent, op sarama.ClientQuotasOp, validateOnly bool) error

func (*MockClusterAdmin) AlterConfig added in v0.24.6

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

func (*MockClusterAdmin) AlterPartitionReassignments added in v0.24.6

func (ca *MockClusterAdmin) AlterPartitionReassignments(topic string, assignment [][]int32) error

func (*MockClusterAdmin) Close added in v0.24.6

func (ca *MockClusterAdmin) Close() error

func (*MockClusterAdmin) Controller added in v0.28.0

func (ca *MockClusterAdmin) Controller() (*sarama.Broker, error)

func (*MockClusterAdmin) CreateACL added in v0.24.6

func (ca *MockClusterAdmin) CreateACL(resource sarama.Resource, acl sarama.Acl) error

func (*MockClusterAdmin) CreatePartitions added in v0.24.6

func (ca *MockClusterAdmin) CreatePartitions(topic string, count int32, assignment [][]int32, validateOnly bool) error

func (*MockClusterAdmin) CreateTopic added in v0.24.6

func (ca *MockClusterAdmin) CreateTopic(topic string, detail *sarama.TopicDetail, validateOnly bool) error

func (*MockClusterAdmin) DeleteACL added in v0.24.6

func (ca *MockClusterAdmin) DeleteACL(filter sarama.AclFilter, validateOnly bool) ([]sarama.MatchingAcl, error)

func (*MockClusterAdmin) DeleteConsumerGroup added in v0.24.6

func (ca *MockClusterAdmin) DeleteConsumerGroup(group string) error

Delete a consumer group.

func (*MockClusterAdmin) DeleteConsumerGroupOffset added in v0.28.0

func (ca *MockClusterAdmin) DeleteConsumerGroupOffset(group string, topic string, partition int32) error

func (*MockClusterAdmin) DeleteRecords added in v0.24.6

func (ca *MockClusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]int64) error

func (*MockClusterAdmin) DeleteTopic added in v0.24.6

func (ca *MockClusterAdmin) DeleteTopic(topic string) error

func (*MockClusterAdmin) DeleteUserScramCredentials added in v0.24.6

func (*MockClusterAdmin) DescribeClientQuotas added in v0.28.0

func (ca *MockClusterAdmin) DescribeClientQuotas(components []sarama.QuotaFilterComponent, strict bool) ([]sarama.DescribeClientQuotasEntry, error)

func (*MockClusterAdmin) DescribeCluster added in v0.24.6

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

func (*MockClusterAdmin) DescribeConfig added in v0.24.6

func (ca *MockClusterAdmin) DescribeConfig(resource sarama.ConfigResource) ([]sarama.ConfigEntry, error)

func (*MockClusterAdmin) DescribeConsumerGroups added in v0.24.6

func (ca *MockClusterAdmin) DescribeConsumerGroups(groups []string) ([]*sarama.GroupDescription, error)

func (*MockClusterAdmin) DescribeLogDirs added in v0.24.6

func (ca *MockClusterAdmin) DescribeLogDirs(brokers []int32) (map[int32][]sarama.DescribeLogDirsResponseDirMetadata, error)

func (*MockClusterAdmin) DescribeTopics added in v0.24.6

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

func (*MockClusterAdmin) DescribeUserScramCredentials added in v0.24.6

func (ca *MockClusterAdmin) DescribeUserScramCredentials(users []string) ([]*sarama.DescribeUserScramCredentialsResult, error)

func (*MockClusterAdmin) ListAcls added in v0.24.6

func (ca *MockClusterAdmin) ListAcls(filter sarama.AclFilter) ([]sarama.ResourceAcls, error)

func (*MockClusterAdmin) ListConsumerGroupOffsets added in v0.24.6

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

func (*MockClusterAdmin) ListConsumerGroups added in v0.24.6

func (ca *MockClusterAdmin) ListConsumerGroups() (map[string]string, error)

func (*MockClusterAdmin) ListPartitionReassignments added in v0.24.6

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

func (*MockClusterAdmin) ListTopics added in v0.24.6

func (ca *MockClusterAdmin) ListTopics() (map[string]sarama.TopicDetail, error)

func (*MockClusterAdmin) UpsertUserScramCredentials added in v0.24.6

Jump to

Keyboard shortcuts

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