tests

package
v0.41.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCantStartCloudEventsServer = errors.New("can't start cloutevents server")

ErrCantStartCloudEventsServer if test cloud event server can't start.

View Source
var ErrCantUnmarshalData = errors.New("can't unmarshal data")

ErrCantUnmarshalData if given bytes can't be unmarshalled as JSON.

Functions

func TimesAlmostEqual added in v0.27.0

func TimesAlmostEqual(at, bt time.Time) bool

TimesAlmostEqual returns true if both times are almost equal.

func UnmarshalCloudEventData

func UnmarshalCloudEventData(bytes []byte) (map[string]interface{}, error)

UnmarshalCloudEventData will take bytes and unmarshall it as JSON to map structure.

func WithCloudEventsServer

func WithCloudEventsServer(test func(serverURL url.URL) error) (*cloudevents.Event, error)

WithCloudEventsServer is a testing utility that help by starting a CloudEvents HTTP server which can catch a sent event.

func WithEnviron

func WithEnviron(env map[string]string, body func() error) error

WithEnviron will execute a block of code with temporal environment set.

Types

type FakeClients

type FakeClients struct {
	testing.TB
	Objects []runtime.Object
	// contains filtered or unexported fields
}

FakeClients creates K8s clients from a list of objects using fake packages.

func (*FakeClients) Context

func (c *FakeClients) Context() context.Context

func (*FakeClients) Dynamic

func (c *FakeClients) Dynamic() dynamic.Interface

func (*FakeClients) Eventing

func (*FakeClients) Messaging

func (*FakeClients) Namespace

func (c *FakeClients) Namespace() string

func (*FakeClients) Serving

func (*FakeClients) Typed

func (c *FakeClients) Typed() kubernetes.Interface

type Sender

type Sender struct {
	Sent []cloudevents.Event
}

Sender is a mock sender that will record sent events for testing.

func (*Sender) Send

func (m *Sender) Send(ce cloudevents.Event) error

Send will send event to specified target.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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