testhelpers

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObserveLogs

func ObserveLogs(
	t *testing.T,
	testLog *zap.SugaredLogger,
) (*zap.SugaredLogger, *observer.ObservedLogs)

ObserveLogs returns a new observable test logger and observed logs based on the specified test logger.

func RequireLastLogEntry

func RequireLastLogEntry(
	t *testing.T,
	observedLogs *observer.ObservedLogs,
	expectedLevel zapcore.Level,
	expectedMessage string,
	expectedFieldsContaining map[string]string,
)

RequireLastLogEntry tests that last log entry from the observed logs has the expected level, it's message contains the expected message and/or has fields having values that contain the expected fields values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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