Documentation
¶
Index ¶
- func EndpointForPort(port int) string
- func GetAvailableLocalAddress(tb testing.TB) string
- func GetAvailableLocalNetworkAddress(tb testing.TB, network string) string
- func GetAvailablePort(tb testing.TB) int
- func SetFeatureGateForTest(tb testing.TB, gate *featuregate.Gate, enabled bool) func()
- func TempDir(tb testing.TB) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndpointForPort ¶ added in v0.111.0
EndpointForPort gets the endpoint for a given port using localhost.
func GetAvailableLocalAddress ¶
GetAvailableLocalAddress finds an available local port on tcp network 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 GetAvailableLocalNetworkAddress ¶ added in v0.57.2
GetAvailableLocalNetworkAddress finds an available local port on specified network 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 SetFeatureGateForTest ¶ added in v0.55.0
func SetFeatureGateForTest(tb testing.TB, gate *featuregate.Gate, enabled bool) func()
Force the state of feature gate for a test usage: defer SetFeatureGateForTest("gateName", true)()
func TempDir ¶ added in v0.136.0
TempDir creates a temporary directory in a safe way. On Linux, it just calls tb.TempDir.
On Windows, it uses os.MkdirTemp to create directory since t.TempDir results in an error during cleanup in scoped-tests, possibly due to an interaction with the -count argument in `go test`. It does not do any cleanup (i.e. the directory is left on the filesystem). Prefer using tb.TempDir directly if possible.
See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/42639
Types ¶
This section is empty.