test

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertIdempotent added in v1.11.0

func AssertIdempotent(t *testing.T, fn func(*testing.T))

AssertIdempotent asserts that the test is valid when run multiple times.

func AssertIdempotentSubtest added in v1.11.0

func AssertIdempotentSubtest(t *testing.T, fn func(*testing.T)) func(*testing.T)

func BoltDB added in v1.11.0

func BoltDB(t *testing.T) *bbolt.DB

func Copy added in v1.1.0

func Copy(t testing.TB, src, dst string)

func CreateInMemoryListeners added in v1.14.0

func CreateInMemoryListeners(addresses []string) (map[string]*bufconn.Listener, grpc.DialOption)

Create in-memory listeners at given addresses. Also returns gRPC dial option for a client to connect to the appropriate in-memory listener for a given address.

func Duration added in v1.11.0

func Duration(d string) time.Duration

func Time added in v1.11.0

func Time(t string) time.Time

func ULID added in v1.11.0

func ULID(t string) string

func UnixMilli added in v1.11.0

func UnixMilli(t string) int64

Types

type CapturedOutput

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

func CaptureOutput

func CaptureOutput(t *testing.T) *CapturedOutput

CaptureOutput replaces os.Stdout and os.Stderr with new pipes, that will write output to buffers. Buffers are accessible by calling Done on returned struct.

os.Stdout and os.Stderr must be reverted to previous values manually.

func (*CapturedOutput) Done

func (co *CapturedOutput) Done() (stdout string, stderr string)

Done waits until all captured output has been written to buffers, and then returns the buffers.

type TestingLogger added in v1.13.0

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

func NewTestingLogger added in v1.2.0

func NewTestingLogger(t testing.TB) *TestingLogger

func (*TestingLogger) Log added in v1.13.0

func (l *TestingLogger) Log(keyvals ...interface{}) error

Jump to

Keyboard shortcuts

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