testutil

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package testutil contains helper functions for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertProtoEqual added in v0.17.0

func AssertProtoEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool

AssertProtoEqual asserts that two protobuf messages equal. Slices of messages are also supported.

func AssertProtoJSONEqual added in v0.9.0

func AssertProtoJSONEqual(t *testing.T, expected string, protoMsg interface{}, msgAndArgs ...interface{}) bool

AssertProtoJSONEqual asserts that a protobuf message matches the given JSON. The protoMsg can also be a slice of protobuf messages.

func ModRoot added in v0.14.0

func ModRoot() string

ModRoot returns the directory containing the go.mod file.

func RedisTLSConfig added in v0.14.0

func RedisTLSConfig() *tls.Config

RedisTLSConfig returns the TLS Config to use with redis.

func TestDataRoot added in v0.14.0

func TestDataRoot() string

TestDataRoot returns the testdata directory.

func WithTestPostgres added in v0.18.0

func WithTestPostgres(handler func(dsn string) error) error

WithTestPostgres starts a test DB and runs the given handler with the connection to it.

func WithTestRedis added in v0.14.0

func WithTestRedis(useTLS bool, handler func(rawURL string) error) error

WithTestRedis creates a test a test redis instance using docker.

func WithTestRedisCluster added in v0.14.0

func WithTestRedisCluster(handler func(rawURL string) error) error

WithTestRedisCluster creates a new redis cluster 3 node cluster.

func WithTestRedisSentinel added in v0.14.0

func WithTestRedisSentinel(handler func(rawURL string) error) error

WithTestRedisSentinel creates a new redis sentinel 3 node cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

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