test

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCalledHandlerFunc

func AssertCalledHandlerFunc(t *testing.T, h watermillmessage.HandlerFunc, times uint32, timeout time.Duration) (handler watermillmessage.HandlerFunc, done chan struct{})

AssertCalledHandlerFunc returns a new HandlerFunc based on a given one that will make the test fail if the given handler has not been called at least `times` before a given timeout.

func NewRouter

func NewRouter(t *testing.T) *watermillmessage.Router

NewRouter creates a watermillmessage.Router with some needed test cleanup actions.

func NewRouterWithLogs

func NewRouterWithLogs(t *testing.T, logger *logrus.Logger) *watermillmessage.Router

NewRouterWithLogs creates a watermillmessage.Router with some needed test cleanup actions. It also configures a logger.

func ReliablePublisher

func ReliablePublisher(t *testing.T, topic string, messagesToAssert int, timeout time.Duration) (publisher *gochannel.GoChannel, done chan struct{})

ReliablePublisher creates a publisher with a subscriber that will make the test fail if the number of published messages does not reach `messagesToAssert` before a given timeout. Should be only used on tests.

Types

type NoopPublisher

type NoopPublisher struct{}

NoopPublisher is a publisher that publishes nothing. Implements watermillmessage.Publisher interface.

func (NoopPublisher) Close

func (n NoopPublisher) Close() error

func (NoopPublisher) Publish

func (n NoopPublisher) Publish(_ string, _ ...*watermillmessage.Message) error

Jump to

Keyboard shortcuts

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