rabbitmq_mock

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_Not_Valid_Data = "expected %v data to be %s, got %s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRabbitDeliveryFields

type MockRabbitDeliveryFields struct {
	Priority        uint8
	Headers         amqp.Table
	DeliveryMode    uint8
	CorelationId    string
	ContentType     string
	ContentEncoding string
	Body            []byte
	Acknowledger    amqp.Acknowledger
	MessageId       string
	AppId           string
	Timestamp       time.Time
	MsgType         string
	UserId          string
	ConsumerTag     string
	DeliveryTag     uint64
	Redelivered     bool
	Exchange        string
	RoutingKey      string
	ReplyTo         string
	Expiration      string
	MessageCount    uint32
}

type RabbitDeliveryMocker

type RabbitDeliveryMocker interface {
	rabbitmq.RabbitDelivery

	ExpectNack(multiple bool, requeue bool, err error)
	ExpectAck(multiple bool, err error)
	ExpectReject(requeue bool, err error)
	AllExpectationsDone() error
}

type RabbitMQMocker

type RabbitMQMocker interface {
	// RabbitMQClient is the interface for the real RabbitMQ client
	rabbitmq.RabbitMQClient

	// ExpectReadMsg records an expectation that ReadMsg will be called
	ExpectReadMsg()
	// ExpectPush records an expectation that Push will be called with the given data and error
	ExpectPush(data []byte, err error)
	// ExpectUnsafePush records an expectation that UnsafePush will be called with the given data and error
	ExpectUnsafePush(data []byte, err error)
	// ExpectConsume records an expectation that Consume will be called with the given error
	ExpectConsume(err error)
	// ExpectClose records an expectation that Close will be called with the given error
	ExpectClose(err error)
	// ExpectCheck records an expectation that Check will be called with the given error
	ExpectCheck(err error)
	// Clear clears all recorded expectations
	Clear()
	// AllExpectationsDone checks if all recorded expectations have been satisfied
	AllExpectationsDone() error
}

func NewRabbitMQ

func NewRabbitMQ(t *testing.T) RabbitMQMocker

Jump to

Keyboard shortcuts

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