test

package
v0.0.0-...-5253b6b Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package test provides utility functions to assist in creating quality tests for adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdapterInvariants

func AdapterInvariants(r adapter.RegisterFn, t *gt.T)

AdapterInvariants ensures that adapters implement expected semantics.

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

Env is an adapter environment that defers to the testing context t. Tracks all messages logged so they can be tested against.

func NewEnv

func NewEnv(t *testing.T) *Env

NewEnv returns an adapter environment that redirects logging output to the given testing context.

func (*Env) Errorf

func (e *Env) Errorf(format string, args ...interface{}) error

Errorf logs the provided message and returns it as an error.

func (*Env) GetLogs

func (e *Env) GetLogs() []string

GetLogs returns a snapshot of all logs that've been written to this environment

func (*Env) Infof

func (e *Env) Infof(format string, args ...interface{})

Infof logs the provided message.

func (*Env) Logger

func (e *Env) Logger() adapter.Logger

Logger returns a logger that writes to testing.T.Log

func (*Env) ScheduleDaemon

func (e *Env) ScheduleDaemon(fn adapter.DaemonFunc)

ScheduleDaemon runs the given function asynchronously.

func (*Env) ScheduleWork

func (e *Env) ScheduleWork(fn adapter.WorkFunc)

ScheduleWork runs the given function asynchronously.

func (*Env) VerbosityLevel

func (e *Env) VerbosityLevel(level adapter.VerbosityLevel) bool

VerbosityLevel return true for test envs (all verbosity levels enabled).

func (*Env) Warningf

func (e *Env) Warningf(format string, args ...interface{})

Warningf logs the provided message.

Jump to

Keyboard shortcuts

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