Documentation ¶
Overview ¶
Package testutil contains utilities used in tests.
Index ¶
- func GetContainerMappedPortAddress(t *testing.T, containerID, privatePort string) string
- func GetInterestingTempDirectoryName() (string, error)
- func MyTestMain(m *testing.M)
- func ProviderTest(t *testing.T)
- func Retry(t *testing.T, testFun func(t *RetriableT))
- func RunContainerAndKillOnCloseOrSkip(t *testing.T, args ...string) string
- func RunDockerAndGetOutputOrSkip(t *testing.T, args ...string) string
- func ShouldReduceTestComplexity() bool
- func TempDirectory(t *testing.T) string
- func TestSkipOnCIUnlessLinuxAMD64(t *testing.T)
- func TestSkipUnlessCI(t *testing.T, msg string, args ...interface{})
- type RetriableT
- func (t *RetriableT) Error(args ...interface{})
- func (t *RetriableT) Errorf(msg string, args ...interface{})
- func (t *RetriableT) Fail()
- func (t *RetriableT) FailNow()
- func (t *RetriableT) Fatal(args ...interface{})
- func (t *RetriableT) Fatalf(msg string, args ...interface{})
- func (t *RetriableT) Skip(args ...interface{})
- func (t *RetriableT) Skipf(msg string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContainerMappedPortAddress ¶ added in v0.8.0
GetContainerMappedPortAddress returns <host>:<port> that can be used to connect to a given container and private port.
func GetInterestingTempDirectoryName ¶ added in v0.8.0
GetInterestingTempDirectoryName returns interesting directory name used for testing.
func MyTestMain ¶ added in v0.8.0
MyTestMain runs tests and verifies some post-run invariants.
func ProviderTest ¶ added in v0.8.0
ProviderTest marks the test method so that it only runs in provider-tests suite.
func Retry ¶
func Retry(t *testing.T, testFun func(t *RetriableT))
Retry invokes the provided test multiple tests until it succeeds.
func RunContainerAndKillOnCloseOrSkip ¶ added in v0.8.0
RunContainerAndKillOnCloseOrSkip runs "docker run" and ensures that resulting container is killed on exit. Returns containerID.
func RunDockerAndGetOutputOrSkip ¶ added in v0.8.0
RunDockerAndGetOutputOrSkip runs Docker and returns the output as a string.
func ShouldReduceTestComplexity ¶ added in v0.8.0
func ShouldReduceTestComplexity() bool
ShouldReduceTestComplexity returns true if test complexity should be reduced on the current machine.
func TempDirectory ¶ added in v0.8.0
TempDirectory returns an interesting temporary directory and cleans it up before test completes.
func TestSkipOnCIUnlessLinuxAMD64 ¶ added in v0.8.0
TestSkipOnCIUnlessLinuxAMD64 skips the current test if running on CI unless the environment is Linux/AMD64.
func TestSkipUnlessCI ¶ added in v0.8.0
TestSkipUnlessCI skips the current test with a provided message, except when running in CI environment, in which case it causes hard failure.
Types ¶
type RetriableT ¶
RetriableT is a wrapper around *testing.T with the same methods that supports retrying tests.
func (*RetriableT) Error ¶
func (t *RetriableT) Error(args ...interface{})
Error wraps testing.T.Error().
func (*RetriableT) Errorf ¶
func (t *RetriableT) Errorf(msg string, args ...interface{})
Errorf wraps testing.T.Errorf().
func (*RetriableT) Fatal ¶
func (t *RetriableT) Fatal(args ...interface{})
Fatal wraps testing.T.Fatal().
func (*RetriableT) Fatalf ¶
func (t *RetriableT) Fatalf(msg string, args ...interface{})
Fatalf wraps testing.T.Fatalf().
func (*RetriableT) Skip ¶
func (t *RetriableT) Skip(args ...interface{})
Skip wraps testing.T.Skip().
func (*RetriableT) Skipf ¶
func (t *RetriableT) Skipf(msg string, args ...interface{})
Skipf wraps testing.T.Skipf().