utils

package
v1.7.0-rc.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitPortClosed

func AwaitPortClosed(port int, timeout time.Duration) error

AwaitPortClosed waits until the port is no longer listening.

func BuildGoBinary

func BuildGoBinary(binaryName, packagePath string) (string, error)

BuildGoBinary builds a Go binary with the given name and package path.

func BuildGoBinaryOnDemand

func BuildGoBinaryOnDemand(env, binaryName, packagePath string) (string, error)

BuildGoBinaryOnDemand builds the binary unless the env variable is set. If the environment variable is set, it will use that path instead.

func FindProjectRoot

func FindProjectRoot() string

FindProjectRoot finds the root of the project by looking for go.mod.

func RequireRandomPorts

func RequireRandomPorts(t testing.TB, count int) []int

RequireRandomPorts returns random available ports.

func RetrieveURL

func RetrieveURL(c client.Client, nn types.NamespacedName, port int32, path string) (string, error)

func ServiceHost

func ServiceHost(c client.Client, nn types.NamespacedName, port int32) (string, error)

Types

type OutBuffer added in v1.6.0

type OutBuffer interface {
	io.Writer
	fmt.Stringer
	Reset()
	Len() int
}

OutBuffer combines io.Writer with fmt.Stringer for buffer access

type OutBuffers added in v1.6.0

type OutBuffers []OutBuffer

OutBuffers allows you to reset all the buffers easily.

func CaptureOutput added in v1.6.0

func CaptureOutput(labels ...string) OutBuffers

CaptureOutput creates labeled OutBuffers in the same order as labels.

func DumpLogsOnFail added in v1.6.0

func DumpLogsOnFail(t testing.TB, labels ...string) OutBuffers

DumpLogsOnFail creates labeled OutBuffers in the same order as labels. The difference between this and CaptureOutput is that when the test fails, these are dumped for diagnosis

func (OutBuffers) Reset added in v1.6.0

func (s OutBuffers) Reset()

Directories

Path Synopsis
Package testotel provides test utilities for OpenTelemetry tests.
Package testotel provides test utilities for OpenTelemetry tests.

Jump to

Keyboard shortcuts

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