Documentation ¶
Index ¶
- func Abs(t *testing.T, path string) string
- func CheckContains(t *testing.T, expected, actual string)
- func CheckDeepEqual(t *testing.T, expected, actual interface{}, opts ...cmp.Option)
- func CheckError(t *testing.T, shouldErr bool, err error)
- func CheckErrorAndDeepEqual(t *testing.T, shouldErr bool, err error, expected, actual interface{}, ...)
- func CheckNotContains(t *testing.T, excluded, actual string)
- func EnsureTestPanicked(t *testing.T)
- func Run(t *testing.T, name string, f func(t *T))
- func ServeFile(t *testing.T, content []byte) string
- func SetupFakeWatcher(w watch.Interface) func(a fake_testing.Action) (handled bool, ret watch.Interface, err error)
- func TempFile(t *testing.T, prefix string, content []byte) string
- type ForTester
- type T
- func (t *T) Chdir(dir string)
- func (t *T) CheckContains(expected, actual string)
- func (t *T) CheckDeepEqual(expected, actual interface{}, opts ...cmp.Option)
- func (t *T) CheckEmpty(actual interface{})
- func (t *T) CheckError(shouldErr bool, err error)
- func (t *T) CheckErrorAndDeepEqual(shouldErr bool, err error, expected, actual interface{}, opts ...cmp.Option)
- func (t *T) CheckErrorContains(message string, err error)
- func (t *T) CheckFalse(actual bool)
- func (t *T) CheckMatches(pattern, actual string)
- func (t *T) CheckNil(actual interface{})
- func (t *T) CheckNotNil(actual interface{})
- func (t *T) CheckTrue(actual bool)
- func (t *T) NewTempDir() *TempDir
- func (t *T) Override(dest, tmp interface{})
- func (t *T) SetArgs(args []string)
- func (t *T) SetEnvs(envs map[string]string)
- func (t *T) SetStdin(content []byte)
- func (t *T) TempFile(prefix string, content []byte) string
- type TempDir
- func (h *TempDir) Chdir() *TempDir
- func (h *TempDir) Chtimes(file string, t time.Time) *TempDir
- func (h *TempDir) Mkdir(dir string) *TempDir
- func (h *TempDir) Path(file string) string
- func (h *TempDir) Paths(files ...string) []string
- func (h *TempDir) Remove(file string) *TempDir
- func (h *TempDir) Rename(oldName, newName string) *TempDir
- func (h *TempDir) Root() string
- func (h *TempDir) Symlink(dst, src string) *TempDir
- func (h *TempDir) Touch(files ...string) *TempDir
- func (h *TempDir) Write(file string, content []byte) *TempDir
- func (h *TempDir) WriteFiles(files map[string][]byte) *TempDir
- func (h *TempDir) WriteRandomFile(file string, size int) *TempDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckContains ¶
func CheckDeepEqual ¶
func CheckErrorAndDeepEqual ¶
func CheckNotContains ¶
func EnsureTestPanicked ¶
func ServeFile ¶
ServeFile serves a file with http. Returns the url to the file and a teardown function that should be called to properly stop the server.
func SetupFakeWatcher ¶
func SetupFakeWatcher(w watch.Interface) func(a fake_testing.Action) (handled bool, ret watch.Interface, err error)
SetupFakeWatcher helps set up a fake Kubernetes watcher
Types ¶
type T ¶
func (*T) CheckContains ¶
func (*T) CheckDeepEqual ¶
func (*T) CheckEmpty ¶
func (t *T) CheckEmpty(actual interface{})
func (*T) CheckError ¶
func (*T) CheckErrorAndDeepEqual ¶
func (*T) CheckErrorContains ¶
CheckErrorContains checks that an error is not nil and contains a given message.
func (*T) CheckFalse ¶
func (*T) CheckMatches ¶
func (*T) CheckNotNil ¶
func (t *T) CheckNotNil(actual interface{})
func (*T) NewTempDir ¶
func (*T) SetEnvs ¶
SetEnvs takes a map of key values to set using os.Setenv and returns a function that can be called to reset the envs to their previous values, or unset envs where previously unset
type TempDir ¶
type TempDir struct {
// contains filtered or unexported fields
}
TempDir offers actions on a temp directory.
func NewTempDir ¶
NewTempDir creates a temporary directory and a teardown function that should be called to properly delete the directory content.
func (*TempDir) WriteFiles ¶
WriteFiles write a list of files (path->content) in the temp directory.