telemetrygolang.org/x/telemetry/internal/testenv Index | Files

package testenv

import "golang.org/x/telemetry/internal/testenv"

Package testenv contains helper functions for skipping tests based on which tools are present in the environment.

Index

Functions

func Go1Point

func Go1Point() int

Go1Point returns the x in Go 1.x.

func HasGo

func HasGo() error

HasGo checks whether the current system has 'go'.

func MustHaveExec

func MustHaveExec(t testing.TB)

MustHaveExec checks that the current system can start new processes using os.StartProcess or (more commonly) exec.Command. If not, MustHaveExec calls t.Skip with an explanation.

func NeedsGo

func NeedsGo(t testing.TB)

NeedsGo skips t if the current system does not have 'go' or cannot run them with exec.Command.

func NeedsGo1Point

func NeedsGo1Point(t testing.TB, x int)

NeedsGo1Point skips t if the Go version used to run the test is older than 1.x.

func NeedsLocalhostNet

func NeedsLocalhostNet(t testing.TB)

NeedsLocalhostNet skips t if networking does not work for ports opened with "localhost".

func SkipIfUnsupportedPlatform

func SkipIfUnsupportedPlatform(t testing.TB)

SkipIfUnsupportedPlatform skips test if the current os/arch are not support.

Source Files

testenv.go

Version
v0.0.0-20250214215356-6f9b61db478c (latest)
Published
Feb 14, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
3 days ago

Tools for package owners.