systemtest

package module
v0.0.0-...-15a994c Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKafkaTopics

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

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

Topics are created with 1 partition and 1 hour of retention.

func CreatePubsubTopicSubscriptions

func CreatePubsubTopicSubscriptions(ctx context.Context, t testing.TB, consumer string, topics ...apmqueue.Topic)

CreatePubsubTopicSubscriptions interacts with the Google Cloud API to create Pub/Sub Lite subscriptions.

func CreatePubsubTopics

func CreatePubsubTopics(ctx context.Context, t testing.TB, topics ...apmqueue.Topic)

CreatePubsubTopics interacts with the Google Cloud API to create Pub/Sub Lite topics.

func DestroyKafka

func DestroyKafka(ctx context.Context) error

DestroyKafka destroys the Redpanda Docker container.

func DestroyPubSubLite

func DestroyPubSubLite(ctx context.Context) error

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 InitPubSubLite

func InitPubSubLite() (ProvisionInfraFunc, DestroyInfraFunc, error)

InitPubSubLite initialises Pub/Sub Lite configuration, and returns a pair of functions for provisioning and destroying a Pub/Sub Lite throughput reservation and associated resources.

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, error)

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 ProvisionPubSubLite

func ProvisionPubSubLite(ctx context.Context) error

ProvisionPubSubLite provisions a Pub/Sub Lite throughput reservation using configuration taken from `gcloud` and $GOOGLE_REGION.

func PubSubLiteCommonConfig

func PubSubLiteCommonConfig(cfg pubsublite.CommonConfig) pubsublite.CommonConfig

PubSubLiteCommonConfig returns a pubsublite.CommonConfig suitable for using to construct pubsublite resources.

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