testutils

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2017 License: MIT Imports: 8 Imported by: 0

README

Test utilities

The functionality in this package is exposed both for internal testing as well as service testability.

InMemoryLogger

If you'd like to verify that log messages are logged properly, use the WithInMemoryLogger() helper which will provider you with a zap.Logger you can pass into a service and capture recorded messages.

Overriding environment variables

If you'd like to override environment variables, use the env.Override() helper and defer the reset to ensure the old value us returned at the end of the test.

Documentation

Overview

Package testutils is the Test utilities.

The functionality in this package is exposed both for internal testing as well as service testability.

InMemoryLogger

If you'd like to verify that log messages are logged properly, use the WithInMemoryLogger() helper which will provider you with a zap.Logger you can pass into a service and capture recorded messages.

Overriding environment variables

If you'd like to override environment variables, use the env.Override() helper and defer the reset to ensure the old value us returned at the end of the test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StaticAppData

func StaticAppData(serviceName *string) config.Provider

StaticAppData creates a Provider for a valid appID/owner

func WithInMemoryLogger

func WithInMemoryLogger(t *testing.T, opts []zap.Option, f func(*zap.Logger, *testutils.Buffer))

WithInMemoryLogger creates an in-memory *zap.Logger that can be used in tests.

Types

type ErrorCloser

type ErrorCloser struct{}

ErrorCloser is a nop implementation of io.Closer

func (ErrorCloser) Close

func (ec ErrorCloser) Close() error

Close implements io.Closer

type NopCloser

type NopCloser struct{}

NopCloser is a nop implementation of io.Closer

func (NopCloser) Close

func (nc NopCloser) Close() error

Close implements io.Closer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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