util

package
v1.13.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaprGRPCClient added in v1.13.0

func DaprGRPCClient(t *testing.T, ctx context.Context, port int) rtv1.DaprClient

DaprGRPCClient returns an unauthenticated gRPC client for Dapr whose connection will be closed on test cleanup.

func FileNames

func FileNames(t *testing.T, num int) []string

func GetMetaComponents added in v1.13.0

func GetMetaComponents(t require.TestingT, ctx context.Context, client *http.Client, port int) []*rtpbv1.RegisteredComponents

func HTTPClient

func HTTPClient(t *testing.T) *http.Client

HTTPClient returns a Go http.Client which has a default timeout of 10 seconds, and separate connection pool to the default allowing tests to be properly isolated when running in parallel. The returned client will call CloseIdleConnections on test cleanup.

func RandomString added in v1.13.0

func RandomString(t *testing.T, n int) string

RandomString generates a random string of length n.

Types

type FreePort

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

FreePort reserves a network ports, and then frees them when the test is ready to run.

func ReservePorts

func ReservePorts(t *testing.T, count int) *FreePort

func (*FreePort) Free

func (f *FreePort) Free(t *testing.T)

func (*FreePort) Port

func (f *FreePort) Port(t *testing.T, n int) int

type ParallelTest added in v1.13.0

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

ParallelTest is a helper for running tests in parallel without having to create new Go test functions.

func NewParallel added in v1.13.0

func NewParallel(t *testing.T, fns ...func(*assert.CollectT)) *ParallelTest

NewParallel creates a new ParallelTest. Tests are executed during given test's cleanup.

func (*ParallelTest) Add added in v1.13.0

func (p *ParallelTest) Add(fn func(*assert.CollectT))

Add adds a test function to be executed in parallel.

Jump to

Keyboard shortcuts

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