Documentation ¶
Overview ¶
Package testutil contains test utilities.
Index ¶
- func GetContainerMappedPortAddress(t *testing.T, containerID, privatePort string) string
- func GetInterestingTempDirectoryName() (string, error)
- func MustParseJSONLines(t *testing.T, lines []string, v interface{})
- func MyTestMain(m *testing.M)
- func ProviderTest(t *testing.T)
- func RunAllTestsWithParam(t *testing.T, v interface{})
- func RunContainerAndKillOnCloseOrSkip(t *testing.T, args ...string) string
- func RunDockerAndGetOutputOrSkip(tb testing.TB, args ...string) string
- func ShouldReduceTestComplexity() bool
- func ShouldSkipLongFilenames() bool
- func ShouldSkipUnicodeFilenames() bool
- func TempDirectory(tb testing.TB) string
- func TempLogDirectory(t *testing.T) string
- func TestSkipOnCIUnlessLinuxAMD64(tb testing.TB)
- func TestSkipUnlessCI(tb testing.TB, 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 MustParseJSONLines ¶ added in v0.9.0
MustParseJSONLines parses the lines containing JSON into the provided object.
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 RunAllTestsWithParam ¶ added in v0.9.0
RunAllTestsWithParam uses reflection to run all test methods starting with 'Test' on the provided object. nolint:thelper
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 ShouldSkipLongFilenames ¶ added in v0.9.1
func ShouldSkipLongFilenames() bool
ShouldSkipLongFilenames returns true if: an environmental variable is unset, set to false, test is running on ARM, or if running race detection.
func ShouldSkipUnicodeFilenames ¶ added in v0.9.1
func ShouldSkipUnicodeFilenames() bool
ShouldSkipUnicodeFilenames returns true if: an environmental variable is unset, set to false, test is running on ARM, or if running race detection.
func TempDirectory ¶ added in v0.8.0
TempDirectory returns an interesting temporary directory and cleans it up before test completes.
func TempLogDirectory ¶ added in v0.9.0
TempLogDirectory returns a temporary directory used for storing logs. If KOPIA_LOGS_DIR is provided.
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 ¶
This section is empty.