testutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeliveryFactory = &mockDeliveryFactory{}
View Source
var DestinationFactory = &mockDestinationFactory{}
View Source
var EventFactory = &mockEventFactory{}
View Source
var TestTopics = []string{
	"user.created",
	"user.deleted",
	"user.updated",
}

must be sorted

Functions

func CheckIntegrationTest

func CheckIntegrationTest(t *testing.T)

func CreateTestLogger

func CreateTestLogger(t *testing.T) *logging.Logger

func CreateTestRedisClient

func CreateTestRedisClient(t *testing.T) *redis.Client

func CreateTestRedisConfig

func CreateTestRedisConfig(t *testing.T) *internalredis.RedisConfig

func DeclareTestAWSInfrastructure

func DeclareTestAWSInfrastructure(ctx context.Context, cfg *mqs.AWSSQSConfig, attributes map[string]string) (string, error)

func DeclareTestRabbitMQInfrastructure

func DeclareTestRabbitMQInfrastructure(ctx context.Context, config *mqs.RabbitMQConfig) error

func ExtractRabbitPassword

func ExtractRabbitPassword(endpoint string) string

ExtractRabbitPassword extracts the password from the endpoint for example: amqp://u:p@localhost:5672 -> p

func ExtractRabbitURL

func ExtractRabbitURL(endpoint string) string

ExtractRabbitURL extracts the address from the endpoint for example: amqp://guest:guest@localhost:5672 -> localhost:5672

func ExtractRabbitUsername

func ExtractRabbitUsername(endpoint string) string

ExtractRabbitUsername extracts the username from the endpoint for example: amqp://u:p@localhost:5672 -> u

func Integration

func Integration(t *testing.T)

func MustMarshalJSON

func MustMarshalJSON(v any) []byte

func NewMockEventTracer

func NewMockEventTracer(exporter traceSDK.SpanExporter) *mockEventTracerImpl

func Race

func Race(t *testing.T)

func RandomPort

func RandomPort() string

Create a random port number between 3500 and 3600

func RandomPortNumber

func RandomPortNumber() int

func RandomString

func RandomString(length int) string

func TeardownTestRabbitMQInfrastructure

func TeardownTestRabbitMQInfrastructure(ctx context.Context, cfg *mqs.RabbitMQConfig) error

Types

type MockMsg

type MockMsg struct {
	ID string
}

func (*MockMsg) FromMessage

func (m *MockMsg) FromMessage(msg *mqs.Message) error

func (*MockMsg) ToMessage

func (m *MockMsg) ToMessage() (*mqs.Message, error)

Jump to

Keyboard shortcuts

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