testutils

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: AGPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger added in v0.32.0

func NewLogger(t testing.TB) *logrus.Logger

NewLogger Returns new logger that will log to the testing.TB.Logf

func NewTestOutput added in v0.27.0

func NewTestOutput(t testing.TB) io.Writer

NewTestOutput returns a simple io.Writer implementation that uses the test's logger as an output.

func SetEnv added in v0.27.0

func SetEnv(t *testing.T, newEnv []string) (restoreEnv func())

SetEnv is a helper funcion for setting arbitrary environment variables and restoring the old ones at the end, usually by deferring the returned callback TODO: remove these hacks when we improve the configuration (hopefully completely, see https://github.com/k6io/k6/issues/883)... we shouldn't have to mess with the global environment at all...

Types

type SimpleLogrusHook added in v0.24.0

type SimpleLogrusHook struct {
	HookedLevels []logrus.Level
	// contains filtered or unexported fields
}

SimpleLogrusHook implements the logrus.Hook interface and could be used to check if log messages were outputted

func (*SimpleLogrusHook) Drain added in v0.24.0

func (smh *SimpleLogrusHook) Drain() []logrus.Entry

Drain returns the currently stored messages and deletes them from the cache

func (*SimpleLogrusHook) Fire added in v0.24.0

func (smh *SimpleLogrusHook) Fire(e *logrus.Entry) error

Fire saves whatever message the logrus library passed in the cache

func (*SimpleLogrusHook) Levels added in v0.24.0

func (smh *SimpleLogrusHook) Levels() []logrus.Level

Levels just returns whatever was stored in the HookedLevels slice

Directories

Path Synopsis
Package httpmultibin is indended only for use in tests, do not import in production code!
Package httpmultibin is indended only for use in tests, do not import in production code!

Jump to

Keyboard shortcuts

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