Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

tests

v0.0.0-20180504072447-bdcd46c54acf
github.com/badu/http/tests

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

34 matches

Top ↑

Package testenv provides information about what functionality is available in different testing environments run by the Go team.

It is an internal package because these details are specific to the Go team's test setup (on build.golang.org) and not fundamental to tests in general.

Variables

UniqNameMu (2 declarations)

var (
	UniqNameMu   sync.Mutex
	UniqNameNext = make(map[string]int)
)

Functions

Builder

func Builder() string

Builder reports the name of the builder running this test (for example, "linux-amd64" or "windows-386-gce"). If the test is not running on the build infrastructure, Builder returns the empty string.

GoTool

func GoTool() (string, error)

GoTool reports the path to the Go tool.

GoToolPath

func GoToolPath(t *testing.T) string

GoToolPath reports the path to the Go tool. It is a convenience wrapper around GoTool. If the tool is unavailable GoToolPath calls t.Skip. If the tool should be available and isn't, GoToolPath calls t.Fatal.

HasExec

func HasExec() bool

HasExec reports whether the current system can start new processes using os.StartProcess or (more commonly) exec.Command.

HasExternalNetwork

func HasExternalNetwork() bool

HasExternalNetwork reports whether the current system can use external (non-localhost) networks.

HasGoBuild

func HasGoBuild() bool

HasGoBuild reports whether the current system can build programs with “go build” and then run them with os.StartProcess or exec.Command.

HasGoRun

func HasGoRun() bool

HasGoRun reports whether the current system can run programs with “go run.”

func HasLink() bool

HasLink reports whether the current system can use os.Link.

HasSrc

func HasSrc() bool

HasSrc reports whether the entire source tree is available under GOROOT.

func HasSymlink() bool

HasSymlink reports whether the current system can use os.Symlink.

MustHaveCGO

func MustHaveCGO(t *testing.T)

MustHaveCGO calls t.Skip if cgo is not available.

MustHaveExec

func MustHaveExec(t *testing.T)

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.

MustHaveExternalNetwork

func MustHaveExternalNetwork(t *testing.T)

MustHaveExternalNetwork checks that the current system can use external (non-localhost) networks. If not, MustHaveExternalNetwork calls t.Skip with an explanation.

MustHaveGoBuild

func MustHaveGoBuild(t *testing.T)

MustHaveGoBuild checks that the current system can build programs with “go build” and then run them with os.StartProcess or exec.Command. If not, MustHaveGoBuild calls t.Skip with an explanation.

MustHaveGoRun

func MustHaveGoRun(t *testing.T)

MustHaveGoRun checks that the current system can run programs with “go run.” If not, MustHaveGoRun calls t.Skip with an explanation.

func MustHaveLink(t *testing.T)

MustHaveLink reports whether the current system can use os.Link. If not, MustHaveLink calls t.Skip with an explanation.

func MustHaveSymlink(t *testing.T)

MustHaveSymlink reports whether the current system can use os.Symlink. If not, MustHaveSymlink calls t.Skip with an explanation.

NewLoggingConn

func NewLoggingConn(baseName string, c net.Conn) net.Conn

NewTestTimeoutHandler

func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler

ResetCachedEnvironment

func ResetCachedEnvironment()

ResetProxyEnv

func ResetProxyEnv()

SkipFlaky

func SkipFlaky(t *testing.T, issue int)

SkipFlakyNet

func SkipFlakyNet(t *testing.T)

Types

RecordingJar

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

RecordingJar keeps a log of calls made to it, without tracking any cookies.

RecordingJar.Cookies

func (j *RecordingJar) Cookies(u *url.URL) []*cli.Cookie

RecordingJar.SetCookies

func (j *RecordingJar) SetCookies(u *url.URL, cookies []*cli.Cookie)

TestJar

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

Just enough correctness for our redirect tests. Uses the URL.Host as the scope of all cookies.

TestJar.Cookies

func (j *TestJar) Cookies(u *url.URL) []*cli.Cookie

TestJar.SetCookies

func (j *TestJar) SetCookies(u *url.URL, cookies []*cli.Cookie)

Dependency graph