test

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy added in v1.1.0

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

func GetFreePorts added in v1.9.0

func GetFreePorts(len int) (ports []int, err error)

GetFreePorts returns a number of free local port for the tests to listen on. Note this will make sure the returned ports do not overlap, by stopping to listen once all ports are allocated

func NewTestingLogger added in v1.2.0

func NewTestingLogger(t testing.TB) log.Logger

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.

Jump to

Keyboard shortcuts

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