testutil

package
v0.0.0-...-54b4948 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestTimeout         = 5 * time.Second
	RPCTestTimeout      = 30 * time.Second
	ProcessTestTimeout  = 15 * time.Second
	ManagerTestTimeout  = 5 * TestTimeout
	ExecutorTestTimeout = 5 * time.Second
	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 AddFileToDirectory

func AddFileToDirectory(dir, fileName, fileContents string) error

AddFileToDirectory adds an archive file given by fileName with the given fileContents to the directory.

func BuildDirectory

func BuildDirectory() string

BuildDirectory is the project-level directory where all build artifacts are put.

func GetPortNumber

func GetPortNumber() int

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

func GolangMainFail

func GolangMainFail() string

GolangMainFail returns the contents of a Golang main script that will fail when run.

func GolangMainSuccess

func GolangMainSuccess() string

GolangMainSuccess returns the contents of a Golang main script that will succeed when run.

func GolangTestFail

func GolangTestFail() string

GolangTestFail returns the contents of a Golang test that will fail when runk.

func GolangTestSuccess

func GolangTestSuccess() string

GolangTestSuccess returns the contents of a Golang test that will succeed when run.

func IsDockerCase

func IsDockerCase(testName string) bool

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

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 WaitForHTTPService

func WaitForHTTPService(ctx context.Context, url string, httpClient *http.Client) error

WaitForHTTPService waits until either the HTTP service becomes available to serve requests to the given URL or the context is done.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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