testenv

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package testenv exposes environment-dependent resources for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustDB

func MustDB(dbname string) (db *sql.DB, cleanup func())

MustDB returns a *sql.DB for dbname, or panics if the database is unreachable. Calling the cleanup func drops all data in the database.

func NewDynamoService

func NewDynamoService(t *testing.T) *dynamodb.DynamoDB

NewDynamoService configures a local dynamo client connected to DYNAMODB_HOST or localhost:8000, which should be running aws-dynamodb-local.

func NewKafkaURLs

func NewKafkaURLs(t testing.TB) []string

NewKafkaURLs returns the broker addresses for Sarama to connect to a local Kafka host at KAFKA_HOST or localhost:9092.

func NewRedisPool

func NewRedisPool(t testing.TB) *redis.Pool

NewRedisPool returns a redis pool connected to RedisURL.

func OpenDatabase

func OpenDatabase(t *testing.T, dbname string) (tx *sql.Tx, close func())

OpenDatabase returns a database connection for testing the provided service. When the close func is called any modified data will be rolled back.

Types

This section is empty.

Jump to

Keyboard shortcuts

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