testutil

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package testutil contains miscellaneous testing utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientTestSetup

func ClientTestSetup(t *testing.T) (ctx context.Context, logger *zap.Logger, teardown func())

ClientTestSetup sets up zap test logging, intercepts HTTP requests using gock, and creates a context with the zap logger embedded.

func GockLogObserver

func GockLogObserver(logger *zap.Logger) gock.ObserverFunc

GockLogObserver returns a gock.ObserverFunc that logs HTTP requests to a zap Logger.

func LoadTestData

func LoadTestData(name string) string

LoadTestData is a helper to load test data from a `testdata` directory relaive to the CWD.

func TestLogger

func TestLogger(t *testing.T) (logger *zap.Logger, teardown func())

TestLogger returns a zap Logger that logs all messages to the given testing.TB. It replaces the zap global Logger and redirects the stdlib log to the test Logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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