Documentation ¶
Overview ¶
Package test provides utility functions to assist in creating quality tests for adapters.
Index ¶
- func AdapterInvariants(r adapter.RegisterFn, t *gt.T)
- type Env
- func (e *Env) Errorf(format string, args ...interface{}) error
- func (e *Env) GetDoneChan() chan struct{}
- func (e *Env) GetLogs() []string
- func (e *Env) Infof(format string, args ...interface{})
- func (e *Env) Logger() adapter.Logger
- func (e *Env) ScheduleDaemon(fn adapter.DaemonFunc)
- func (e *Env) ScheduleWork(fn adapter.WorkFunc)
- func (e *Env) VerbosityLevel(level adapter.VerbosityLevel) bool
- func (e *Env) Warningf(format string, args ...interface{})
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 ¶
NewEnv returns an adapter environment that redirects logging output to the given testing context.
func (*Env) GetDoneChan ¶
func (e *Env) GetDoneChan() chan struct{}
GetDoneChan returns the channel that returns notification when the async work is done.
func (*Env) GetLogs ¶
GetLogs returns a snapshot of all logs that've been written to this environment
func (*Env) ScheduleDaemon ¶
func (e *Env) ScheduleDaemon(fn adapter.DaemonFunc)
ScheduleDaemon runs the given function asynchronously.
func (*Env) ScheduleWork ¶
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).