Documentation ¶
Index ¶
- Variables
- func CleanUpTmpFiles(t TestReporter)
- func RunSpecWithJUnitReporter(t *testing.T, description string)
- func TemporaryEnvVars(keyValues ...string) func()
- func TemporaryUnsetEnvVars(keys ...string) func()
- func TmpDir(t TestReporter, dir string) string
- func TmpFile(t TestReporter, filePath, content string) afero.File
- type Cmd
- type TestReporter
- type TmpPath
Constants ¶
This section is empty.
Variables ¶
var Files []string
Files keeps track of files that we've used so we can clean up.
Functions ¶
func CleanUpTmpFiles ¶
func CleanUpTmpFiles(t TestReporter)
CleanUpTmpFiles removes all files in our test registry and calls `t.Errorf` if something goes wrong.
func RunSpecWithJUnitReporter ¶
RunSpecWithJUnitReporter calls custom ginkgo junit reporter.
func TemporaryEnvVars ¶ added in v0.0.2
func TemporaryEnvVars(keyValues ...string) func()
func TemporaryUnsetEnvVars ¶ added in v0.0.9
func TemporaryUnsetEnvVars(keys ...string) func()
func TmpDir ¶
func TmpDir(t TestReporter, dir string) string
TmpDir creates a temporary directory under os.TempDir() with a following pattern: os.TempDir()/[random-alphanumeric]/dir, where dir is a passed parameter which can be a relative path When dir is an absolute path and error is reported.
func TmpFile ¶
func TmpFile(t TestReporter, filePath, content string) afero.File
TmpFile creates a specified file for us to use when testing if filePath is a full path it will just be created and cleaned up afterwards otherwise the file will be places under some random alphanumeric folder under temp directory.
Types ¶
type Cmd ¶
Cmd is an alias for cobra.Command to build fluent API for building commands in tests.
func ValidateArgumentsOf ¶
ValidateArgumentsOf will not run actual command but let the initialization and validation happen.
type TestReporter ¶
type TestReporter interface {
Errorf(format string, args ...interface{})
}
TestReporter can be used to report test failures. It is satisfied by the standard library's *testing.T.
type TmpPath ¶
type TmpPath struct {
// contains filtered or unexported fields
}
TmpPath lets you overwrite $PATH environment variable for the duration of tests.
func NewTmpPath ¶
func NewTmpPath() *TmpPath
NewTmpPath creates new instance of TmpPath with stored original value assigned to $PATH environment variable.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
test-service
Code generated for package main by go-bindata DO NOT EDIT.
|
Code generated for package main by go-bindata DO NOT EDIT. |
Test double that echoes passed arguments and flags.
|
Test double that echoes passed arguments and flags. |