Documentation
¶
Overview ¶
Package rabbittest provides "stretchr/testify/suite" testing suite with prepared RabbitMQ connection, channel or topology.
Usage:
// embedding ChannelSuite
type TestSuite struct {
rabbittest.ChannelSuite
}
func (s *TestSuite) TestMyFunction() {
s.Channel.Publish(...)
}
Set up RABBITMQ_URL environment variable and tun tests:
RABBITMQ_URL=amqp://localhost:5672 go test -v ./...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelSuite ¶
type ChannelSuite struct {
ConnectionSuite
Channel *amqp.Channel
}
ChannelSuite uses ConnectionSuite to create connection and then creates new channel for each test.
func (*ChannelSuite) SetupTest ¶
func (s *ChannelSuite) SetupTest()
func (*ChannelSuite) TearDownTest ¶
func (s *ChannelSuite) TearDownTest()
type ConnectionSuite ¶
type ConnectionSuite struct {
suite.Suite
Connection *connection.Redialer
}
ConnectionSuite creates RabbitMQ connection on test setup.
func (*ConnectionSuite) SetupSuite ¶
func (s *ConnectionSuite) SetupSuite()
func (*ConnectionSuite) TearDownSuite ¶
func (s *ConnectionSuite) TearDownSuite()
type TopologySuite ¶
type TopologySuite struct {
ChannelSuite
Exchange string
Queue string
Key string
}
TopologySuite uses ChannelSuite to create channel and then creates new topology using this channel.
func (*TopologySuite) SetupTest ¶
func (s *TopologySuite) SetupTest()
func (*TopologySuite) TearDownTest ¶
func (s *TopologySuite) TearDownTest()
Click to show internal directories.
Click to hide internal directories.