testing

package
v0.0.0-...-78446cc Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationName         = "testapp1023"
	ApplicationNameNotClean = "testapp_1-0+2=3"

	MessagingNamespace = "/messaging.namespace"
	Prefix             = "prefix"
	EmptyPrefix        = ""

	EventID      = "8945ec08-256b-11eb-9928-acde48001122"
	EventData    = `{\"key\":\"value\"}`
	EventName    = "order.created"
	EventVersion = "v1"

	CloudEventNameAndVersion         = EventName + "." + EventVersion
	CloudEventType                   = ApplicationName + "." + CloudEventNameAndVersion
	CloudEventTypeNotClean           = ApplicationNameNotClean + "." + CloudEventNameAndVersion
	CloudEventTypeWithPrefix         = Prefix + "." + CloudEventType
	CloudEventTypeWithPrefixNotClean = Prefix + "." + CloudEventTypeNotClean
	CloudEventSource                 = "/default/sap.kyma/id"
	CloudEventSpecVersion            = "1.0"

	LegacyEventTime = "2020-04-02T21:37:00Z"

	OldEventTypePrefix = "sap.kyma.custom"
)
View Source
const (
	CeIDHeader          = "ce-id"
	CeTypeHeader        = "ce-type"
	CeSourceHeader      = "ce-source"
	CeSpecVersionHeader = "ce-specversion"
)

binary cloudevent headers.

View Source
const (
	StreamName = "kyma"
)

Variables

This section is empty.

Functions

func ConnectToNATSServer

func ConnectToNATSServer(url string) (*nats.Conn, error)

func GeneratePortOrDie

func GeneratePortOrDie() int

GeneratePortOrDie generates a random 5 digit port or fail.

func NewEnvConfig

func NewEnvConfig(emsCEURL, authURL string, opts ...EnvConfigOption) *env.EventMeshConfig

func StartNATSServer

func StartNATSServer() *server.Server

Types

type CloudEvent

type CloudEvent struct {
	Event
	// contains filtered or unexported fields
}

type CloudEventBuilder

type CloudEventBuilder struct {
	CloudEvent
}

func NewCloudEventBuilder

func NewCloudEventBuilder(opts ...CloudEventBuilderOpt) *CloudEventBuilder

func (*CloudEventBuilder) Build

func (b *CloudEventBuilder) Build(t *testing.T) *ceevent.Event

func (*CloudEventBuilder) BuildBinary

func (b *CloudEventBuilder) BuildBinary() (string, http.Header)

func (*CloudEventBuilder) BuildStructured

func (b *CloudEventBuilder) BuildStructured() (string, http.Header)

type CloudEventBuilderOpt

type CloudEventBuilderOpt func(*CloudEventBuilder)

func WithCloudEventID

func WithCloudEventID(id string) CloudEventBuilderOpt

func WithCloudEventSource

func WithCloudEventSource(eventSource string) CloudEventBuilderOpt

func WithCloudEventSpecVersion

func WithCloudEventSpecVersion(specVersion string) CloudEventBuilderOpt

func WithCloudEventType

func WithCloudEventType(eventType string) CloudEventBuilderOpt

type EnvConfigOption

type EnvConfigOption func(e *env.EventMeshConfig)

func WithEventTypePrefix

func WithEventTypePrefix(eventTypePrefix string) EnvConfigOption

func WithMaxIdleConns

func WithMaxIdleConns(maxIdleConns int) EnvConfigOption

func WithMaxIdleConnsPerHost

func WithMaxIdleConnsPerHost(maxIdleConnsPerHost int) EnvConfigOption

func WithNamespace

func WithNamespace(namespace string) EnvConfigOption

func WithPort

func WithPort(port int) EnvConfigOption

func WithRequestTimeout

func WithRequestTimeout(requestTimeout time.Duration) EnvConfigOption

type Event

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

type LegacyEvent

type LegacyEvent struct {
	Event
	// contains filtered or unexported fields
}

type LegacyEventBuilder

type LegacyEventBuilder struct {
	LegacyEvent
}

func NewLegacyEventBuilder

func NewLegacyEventBuilder(opts ...LegacyEventBuilderOpt) *LegacyEventBuilder

func (*LegacyEventBuilder) Build

func (b *LegacyEventBuilder) Build() (string, http.Header)

type LegacyEventBuilderOpt

type LegacyEventBuilderOpt func(*LegacyEventBuilder)

func WithLegacyEventData

func WithLegacyEventData(data string) LegacyEventBuilderOpt

func WithLegacyEventID

func WithLegacyEventID(id string) LegacyEventBuilderOpt

func WithLegacyEventTime

func WithLegacyEventTime(eventTime string) LegacyEventBuilderOpt

func WithLegacyEventType

func WithLegacyEventType(eventType string) LegacyEventBuilderOpt

func WithLegacyEventTypeVersion

func WithLegacyEventTypeVersion(eventTypeVersion string) LegacyEventBuilderOpt

type MockServer

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

func NewMockServer

func NewMockServer(opts ...MockServerOption) *MockServer

func (*MockServer) Close

func (m *MockServer) Close()

func (*MockServer) GeneratedTokensCount

func (m *MockServer) GeneratedTokensCount() int

func (*MockServer) Start

func (m *MockServer) Start(t *testing.T, tokenEndpoint, eventsEndpoint, eventsWithHTTP400 string)

func (*MockServer) URL

func (m *MockServer) URL() string

type MockServerOption

type MockServerOption func(m *MockServer)

func WithExpiresIn

func WithExpiresIn(expiresIn int) MockServerOption

func WithResponseTime

func WithResponseTime(responseTime time.Duration) MockServerOption

func WithValidator

func WithValidator(validator Validator) MockServerOption

type SubscriptionOpt

type SubscriptionOpt func(*emeventingv1alpha1.Subscription)

type Validator

type Validator func(r *http.Request) error

Validator is used to validate incoming requests to the mock server.

Jump to

Keyboard shortcuts

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