Documentation
¶
Overview ¶
Package testutil contains test utilities.
Index ¶
- func GetContainerMappedPortAddress(t *testing.T, containerID, privatePort string) string
- func GetInterestingTempDirectoryName() (string, error)
- func MustGetTotalDirSize(t *testing.T, dirpath string) int64
- func MustParseJSONLines(t *testing.T, lines []string, v interface{})
- func MyTestMain(m *testing.M, cleanups ...func())
- 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 SkipNonDeterministicTestUnderCodeCoverage(t *testing.T)
- func TempDirectory(tb testing.TB) string
- func TempDirectoryShort(tb testing.TB) string
- func TempLogDirectory(t *testing.T) string
- func TestSkipOnCIUnlessLinuxAMD64(tb testing.TB)
- func TestSkipUnlessCI(tb testing.TB, msg string, args ...interface{})
- func TestSkipUnlessLinux(tb testing.TB)
- type ServerParameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContainerMappedPortAddress ¶
GetContainerMappedPortAddress returns <host>:<port> that can be used to connect to a given container and private port.
func GetInterestingTempDirectoryName ¶
GetInterestingTempDirectoryName returns interesting directory name used for testing.
func MustGetTotalDirSize ¶
MustGetTotalDirSize computes the total size of a directory.
func MustParseJSONLines ¶
MustParseJSONLines parses the lines containing JSON into the provided object.
func MyTestMain ¶
MyTestMain runs tests and verifies some post-run invariants.
func ProviderTest ¶
ProviderTest marks the test method so that it only runs in provider-tests suite.
func RunAllTestsWithParam ¶
RunAllTestsWithParam uses reflection to run all test methods starting with 'Test' on the provided object.
func RunContainerAndKillOnCloseOrSkip ¶
RunContainerAndKillOnCloseOrSkip runs "docker run" and ensures that resulting container is killed on exit. Returns containerID.
func RunDockerAndGetOutputOrSkip ¶
RunDockerAndGetOutputOrSkip runs Docker and returns the output as a string.
func ShouldReduceTestComplexity ¶
func ShouldReduceTestComplexity() bool
ShouldReduceTestComplexity returns true if test complexity should be reduced on the current machine.
func ShouldSkipLongFilenames ¶
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 ¶
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 SkipNonDeterministicTestUnderCodeCoverage ¶
SkipNonDeterministicTestUnderCodeCoverage skips the non-deterministic test for a code coverage run.
func TempDirectory ¶
TempDirectory returns an interesting temporary directory and cleans it up before test completes.
func TempDirectoryShort ¶
TempDirectoryShort returns a short temporary directory and cleans it up before test completes.
func TempLogDirectory ¶
TempLogDirectory returns a temporary directory used for storing logs. If KOPIA_LOGS_DIR is provided.
func TestSkipOnCIUnlessLinuxAMD64 ¶
TestSkipOnCIUnlessLinuxAMD64 skips the current test if running on CI unless the environment is Linux/AMD64.
func TestSkipUnlessCI ¶
TestSkipUnlessCI skips the current test with a provided message, except when running in CI environment, in which case it causes hard failure.
func TestSkipUnlessLinux ¶
TestSkipUnlessLinux skips the current test if the test environment is not Linux.
Types ¶
type ServerParameters ¶
type ServerParameters struct {
BaseURL string
SHA256Fingerprint string
Password string
ServerControlPassword string
}
ServerParameters encapsulates parameters captured by processing stderr of 'kopia server start'.
func (*ServerParameters) ProcessOutput ¶
func (s *ServerParameters) ProcessOutput(l string) bool
ProcessOutput processes output lines from a server that's starting up.