tests

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSimpleMessagesParallel

func AddSimpleMessagesParallel(t *testing.T, messagesCount int, publisher message.Publisher, topicName string, publishers int) message.Messages

func AssertAllMessagesReceived

func AssertAllMessagesReceived(t *testing.T, sent message.Messages, received message.Messages) bool

func AssertMessagesMetadata

func AssertMessagesMetadata(t *testing.T, key string, expectedValues map[string]string, received []*message.Message) bool

func AssertMessagesPayloads

func AssertMessagesPayloads(
	t *testing.T,
	expectedPayloads map[string]interface{},
	received []*message.Message,
) bool

func BenchSubscriber

func BenchSubscriber(b *testing.B, pubSubConstructor BenchmarkPubSubConstructor)

func MissingMessages

func MissingMessages(expected message.Messages, received message.Messages) []string

func PublishSimpleMessages

func PublishSimpleMessages(t *testing.T, messagesCount int, publisher message.Publisher, topicName string) message.Messages

func RunOnlyFastTests

func RunOnlyFastTests() bool

RunOnlyFastTests returns true if -short flag was provided -race was not provided. Useful for excluding some slow tests.

func TestConcurrentClose

func TestConcurrentClose(
	t *testing.T,
	tCtx TestContext,
	createPubSub PubSubConstructor,
)

func TestConcurrentSubscribe

func TestConcurrentSubscribe(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestConsumerGroups

func TestConsumerGroups(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor ConsumerGroupPubSubConstructor,
)

func TestContinueAfterErrors

func TestContinueAfterErrors(
	t *testing.T,
	tCtx TestContext,
	createPubSub PubSubConstructor,
)

func TestContinueAfterSubscribeClose

func TestContinueAfterSubscribeClose(
	t *testing.T,
	tCtx TestContext,
	createPubSub PubSubConstructor,
)

TestContinueAfterSubscribeClose checks, that we don't lose messages after closing subscriber.

func TestMessageCtx

func TestMessageCtx(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestNewSubscriberReceivesOldMessages

func TestNewSubscriberReceivesOldMessages(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestNoAck

func TestNoAck(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestPubSub

func TestPubSub(
	t *testing.T,
	features Features,
	pubSubConstructor PubSubConstructor,
	consumerGroupPubSubConstructor ConsumerGroupPubSubConstructor,
)

func TestPubSubStressTest

func TestPubSubStressTest(
	t *testing.T,
	features Features,
	pubSubConstructor PubSubConstructor,
	consumerGroupPubSubConstructor ConsumerGroupPubSubConstructor,
)

func TestPublishSubscribe

func TestPublishSubscribe(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestPublishSubscribeInOrder

func TestPublishSubscribeInOrder(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestPublisherClose

func TestPublisherClose(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

TestPublisherClose sends big amount of messages and them run close to ensure that messages are not lost during adding.

func TestReconnect

func TestReconnect(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestResendOnError

func TestResendOnError(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestSubscribeCtx

func TestSubscribeCtx(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

func TestTopic

func TestTopic(
	t *testing.T,
	tCtx TestContext,
	pubSubConstructor PubSubConstructor,
)

Types

type BenchmarkPubSubConstructor

type BenchmarkPubSubConstructor func(n int) (message.Publisher, message.Subscriber)

type ConsumerGroupPubSubConstructor

type ConsumerGroupPubSubConstructor func(t *testing.T, consumerGroup string) (message.Publisher, message.Subscriber)

type Features

type Features struct {
	ConsumerGroups      bool
	ExactlyOnceDelivery bool

	GuaranteedOrder bool
	// Some Pub/Subs guarantees order only when one subscriber is subscribing.
	GuaranteedOrderWithSingleSubscriber bool

	Persistent bool

	RestartServiceCommand []string

	// RequireSingleInstance must be true, if PubSub requires single instance to work properly
	// (for example: channel implementation).
	RequireSingleInstance bool

	NewSubscriberReceivesOldMessages bool
}

Features are used to configure Pub/Subs implementations behaviour. Different features set decides also which, and how tests should be run.

type PubSubConstructor

type PubSubConstructor func(t *testing.T) (message.Publisher, message.Subscriber)

type SimpleMessage

type SimpleMessage struct {
	Num int `json:"num"`
}

type TestContext

type TestContext struct {
	// Unique ID of the test
	TestID TestID

	// PubSub features
	Features Features
}

type TestID

type TestID string

func NewTestID

func NewTestID() TestID

Jump to

Keyboard shortcuts

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