Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TemporaryEnvVars ¶ added in v0.0.2
func TemporaryEnvVars(keyValues ...string) func()
func TemporaryUnsetEnvVars ¶ added in v0.0.9
func TemporaryUnsetEnvVars(keys ...string) func()
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 TmpFileSystem ¶ added in v0.5.0
type TmpFileSystem struct {
// contains filtered or unexported fields
}
func NewTmpFileSystem ¶ added in v0.5.0
func NewTmpFileSystem(t TestReporter) TmpFileSystem
func (*TmpFileSystem) Cleanup ¶ added in v0.5.0
func (tmp *TmpFileSystem) Cleanup()
Cleanup removes all files in our test registry and calls `t.Errorf` if something goes wrong.
func (*TmpFileSystem) Dir ¶ added in v0.5.0
func (tmp *TmpFileSystem) Dir(dir string) string
Dir 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 (*TmpFileSystem) File ¶ added in v0.5.0
func (tmp *TmpFileSystem) File(filePath, content string) afero.File
File creates a specified file 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.
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.
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. |