systemtest

package
v2.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package systemtest holds system/integration tests that test the apm-queue/kafka and apm-queue/pubsublite producer and consumer behaviour against real brokers/clusters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKafkaTopics

func CreateKafkaTopics(ctx context.Context, t testing.TB, partitions int, topics ...apmqueue.Topic)

CreateKafkaTopics interacts with the Kafka broker to create topics, deleting them when the test completes.

Topics are created with given partitions and 1 hour of retention.

func DestroyKafka

func DestroyKafka(ctx context.Context) error

DestroyKafka destroys the Redpanda Docker container.

func InitKafka

InitKafka initialises Kafka configuration, and returns a pair of functions for provisioning and destroying a Kafka cluster.

If KAFKA_BROKERS is set, provisioning and destroying are skipped, and Kafka clients will be configured to communicate with those brokers.

func KafkaCommonConfig

func KafkaCommonConfig(t testing.TB, cfg kafka.CommonConfig) kafka.CommonConfig

KafkaCommonConfig returns a kafka.CommonConfig suitable for connecting to the configured Kafka broker in tests.

When Redpanda is running locally in Docker, this will ignore the advertised address and use the forwarded port.

func NewKafkaManager

func NewKafkaManager(t testing.TB) *kafka.Manager

NewKafkaManager returns a new kafka.Manager for the configured broker.

func ProvisionKafka

func ProvisionKafka(ctx context.Context) error

ProvisionKafka starts a single node Redpanda broker running as a local Docker container, and configures Kafka clients to communicate with the broker by forwarding the necessary port(s).

func RandomSuffix

func RandomSuffix() string

RandomSuffix generates a lowercase alphabetic 8 character random string

func SuffixTopics

func SuffixTopics(topics ...apmqueue.Topic) []apmqueue.Topic

SuffixTopics suffixes the received topics with a random suffix.

func TestLogger

func TestLogger(t testing.TB) *zap.Logger

TestLogger creates a new zap.Logger meant to be used for tests. It only prints logs when the tests fails, or the logger calls t.Error

Types

type DestroyInfraFunc

type DestroyInfraFunc func(context.Context) error

DestroyInfraFunc is a function returned by Init* functions for destroying infrastructure.

type ProvisionInfraFunc

type ProvisionInfraFunc func(context.Context) error

ProvisionInfraFunc is a function returned by Init* functions for provisioning infrastructure.

Jump to

Keyboard shortcuts

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