testutil

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvailableLocalAddress

func GetAvailableLocalAddress(t *testing.T) string

GetAvailableLocalAddress finds an available local port and returns an endpoint describing it. The port is available for opening when this function returns provided that there is no race by some other code to grab the same port immediately.

func GetAvailablePort

func GetAvailablePort(t *testing.T) uint16

GetAvailablePort finds an available local port and returns it. The port is available for opening when this function returns provided that there is no race by some other code to grab the same port immediately.

func NewTemporaryDirectory

func NewTemporaryDirectory(tb testing.TB) (absolutePath string)

NewTemporaryDirectory creates a new temporary directory that can be used within the scope of test or benchmark and the directory will be cleaned up with all files contained within directory.

func NewTemporaryFile

func NewTemporaryFile(tb testing.TB) *os.File

NewTemporaryFile creates a file that can be used within the scope of the test and will be closed then removed from the file system during the test cleanup

Types

This section is empty.

Jump to

Keyboard shortcuts

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