testing

package
v0.1.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Provider destregistry.Provider
	Dest     *models.Destination
	Consumer MessageConsumer
	// Optional asserter for provider-specific message checks
	Asserter MessageAsserter
}

Config is used to initialize the test suite

type Message

type Message struct {
	Data     []byte
	Metadata map[string]string
	// Raw contains the provider-specific message type (e.g. amqp.Delivery, http.Request)
	Raw interface{}
}

Message represents a message that was received by the consumer

type MessageAsserter

type MessageAsserter interface {
	// AssertMessage is called after the base assertions to allow provider-specific checks
	AssertMessage(t TestingT, msg Message, event models.Event)
}

MessageAsserter allows providers to add their own assertions on the raw message

type MessageConsumer

type MessageConsumer interface {
	// Consume returns a channel that receives messages
	Consume() <-chan Message
	// Close stops consuming messages
	Close() error
}

MessageConsumer is the interface that providers must implement

type PublisherSuite

type PublisherSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

PublisherSuite is the base test suite that providers should embed

func (*PublisherSuite) InitSuite

func (s *PublisherSuite) InitSuite(cfg Config)

func (*PublisherSuite) SetupTest

func (s *PublisherSuite) SetupTest()

func (*PublisherSuite) TearDownTest

func (s *PublisherSuite) TearDownTest()

func (*PublisherSuite) TestBasicPublish

func (s *PublisherSuite) TestBasicPublish()

func (*PublisherSuite) TestClosePublisherDuringConcurrentPublish

func (s *PublisherSuite) TestClosePublisherDuringConcurrentPublish()

func (*PublisherSuite) TestConcurrentPublish

func (s *PublisherSuite) TestConcurrentPublish()

type TestingT

type TestingT interface {
	Errorf(format string, args ...interface{})
	FailNow()
	Helper()
}

TestingT is a subset of testing.T that we need for assertions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳