testutil

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestTimeout        = 5 * time.Second
	RPCTestTimeout     = 30 * time.Second
	ProcessTestTimeout = 15 * time.Second
	ManagerTestTimeout = 5 * TestTimeout
	LongTestTimeout    = 100 * time.Second
)

Constants for test timeouts.

View Source
const DefaultDockerImage = "ubuntu"

DefaultDockerImage is the default image for testing Docker.

Variables

This section is empty.

Functions

func BuildDirectory

func BuildDirectory() string

func FalseCreateOpts

func FalseCreateOpts() *options.Create

FalseCreateOpts creates the options to run the "false" command.

func GetHTTPClient

func GetHTTPClient() *http.Client

GetHTTPClient gets an HTTP client from the client pool.

func GetPortNumber

func GetPortNumber() int

GetPortNumber returns a new port number that has not been used in the current runtime.

func IsDockerCase

func IsDockerCase(testName string) bool

IsDockerCase returns whether or not the test case is a Docker test case.

func PutHTTPClient

func PutHTTPClient(client *http.Client)

PutHTTPClient returns the given HTTP client back to the pool.

func RemoveWhitespace

func RemoveWhitespace(str string) string

RemoveWhitespace returns the string without any whitespace characters.

func SkipDockerIfUnsupported

func SkipDockerIfUnsupported(t *testing.T)

SkipDockerIfUnsupported skips the test if the platform is not Linux or the SKIP_DOCKER_TESTS environment variable is explicitly set.

func SleepCreateOpts

func SleepCreateOpts(num int) *options.Create

SleepCreateOpts creates the options to run the "sleep" command for the give nnumber of seconds.

func TrueCreateOpts

func TrueCreateOpts() *options.Create

TrueCreateOpts creates the options to run the "true" command.

func WaitForRESTService

func WaitForRESTService(ctx context.Context, url string) error

WaitForRESTService waits until either the REST service becomes available to serve requests or the context is done.

func WaitForWireService

func WaitForWireService(ctx context.Context, addr net.Addr) error

WaitForWireService waits until either the wire service becomes available to serve requests or the context times out.

func YesCreateOpts

func YesCreateOpts(timeout time.Duration) *options.Create

YesCreateOpts creates the options to run the "yes" command for the given duration.

Types

type OptsModify

type OptsModify func(*options.Create)

OptsModify functions mutate creation options for tests.

Jump to

Keyboard shortcuts

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