Documentation ¶
Index ¶
- 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 EnsureTestPanicked(t *testing.T)
- func Run(t *testing.T, name string, f func(t *T))
- func ServeFile(t *testing.T, content []byte) (url string, tearDown func())
- 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) (name string, tearDown func())
- type FakeAPIClient
- func (f *FakeAPIClient) Close() error
- func (f *FakeAPIClient) ImageBuild(_ context.Context, _ io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (f *FakeAPIClient) ImageInspectWithRaw(_ context.Context, ref string) (types.ImageInspect, []byte, error)
- func (f *FakeAPIClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
- func (f *FakeAPIClient) ImagePull(_ context.Context, ref string, _ types.ImagePullOptions) (io.ReadCloser, error)
- func (f *FakeAPIClient) ImagePush(_ context.Context, ref string, _ types.ImagePushOptions) (io.ReadCloser, error)
- func (f *FakeAPIClient) ImageTag(_ context.Context, image, ref string) error
- func (f *FakeAPIClient) Info(context.Context) (types.Info, error)
- type FakeCmd
- func FakeRun(t *testing.T, command string) *FakeCmd
- func FakeRunErr(t *testing.T, command string, err error) *FakeCmd
- func FakeRunInput(t *testing.T, command, input string) *FakeCmd
- func FakeRunOut(t *testing.T, command string, output string) *FakeCmd
- func FakeRunOutErr(t *testing.T, command string, output string, err error) *FakeCmd
- func NewFakeCmd(t *testing.T) *FakeCmd
- func (c *FakeCmd) RunCmd(cmd *exec.Cmd) error
- func (c *FakeCmd) RunCmdOut(cmd *exec.Cmd) ([]byte, error)
- func (c *FakeCmd) WithRun(command string) *FakeCmd
- func (c *FakeCmd) WithRunErr(command string, err error) *FakeCmd
- func (c *FakeCmd) WithRunInput(command, input string) *FakeCmd
- func (c *FakeCmd) WithRunOut(command string, output string) *FakeCmd
- func (c *FakeCmd) WithRunOutErr(command string, output string, err error) *FakeCmd
- type T
- func (t *T) CheckContains(expected, actual string)
- func (t *T) CheckDeepEqual(expected, actual interface{}, opts ...cmp.Option)
- 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) CheckErrorAndTypeEquality(shouldErr bool, err error, expected, actual interface{})
- func (t *T) CheckErrorContains(message string, err error)
- func (t *T) CheckNoError(err error)
- func (t *T) FakeRun(command string) *FakeCmd
- func (t *T) FakeRunOut(command string, output string) *FakeCmd
- func (t *T) FakeRunOutErr(command string, output string, err error) *FakeCmd
- func (t *T) NewTempDir() *TempDir
- func (t *T) Override(dest, tmp interface{})
- func (t *T) SetEnvs(envs map[string]string)
- func (t *T) SetupFakeKubernetesContext(config api.Config)
- 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) List() ([]string, error)
- 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, content string) *TempDir
- func (h *TempDir) WriteFiles(files map[string]string) *TempDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckContains ¶ added in v0.25.0
func CheckDeepEqual ¶ added in v0.14.0
func CheckErrorAndDeepEqual ¶
func EnsureTestPanicked ¶ added in v0.31.0
func ServeFile ¶ added in v0.2.0
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 ¶ added in v0.33.0
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 FakeAPIClient ¶ added in v0.21.0
type FakeAPIClient struct { client.CommonAPIClient TagToImageID map[string]string ImageSummaries []types.ImageSummary RepoDigests []string ErrImageBuild bool ErrImageInspect bool ErrImageTag bool ErrImagePush bool ErrImagePull bool ErrStream bool Tagged []string Pushed []string Built []types.ImageBuildOptions PushedImages []string // contains filtered or unexported fields }
func (*FakeAPIClient) Close ¶ added in v0.21.0
func (f *FakeAPIClient) Close() error
func (*FakeAPIClient) ImageBuild ¶ added in v0.21.0
func (f *FakeAPIClient) ImageBuild(_ context.Context, _ io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
func (*FakeAPIClient) ImageInspectWithRaw ¶ added in v0.21.0
func (f *FakeAPIClient) ImageInspectWithRaw(_ context.Context, ref string) (types.ImageInspect, []byte, error)
func (*FakeAPIClient) ImageList ¶ added in v0.24.0
func (f *FakeAPIClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
func (*FakeAPIClient) ImagePull ¶ added in v0.21.1
func (f *FakeAPIClient) ImagePull(_ context.Context, ref string, _ types.ImagePullOptions) (io.ReadCloser, error)
func (*FakeAPIClient) ImagePush ¶ added in v0.21.0
func (f *FakeAPIClient) ImagePush(_ context.Context, ref string, _ types.ImagePushOptions) (io.ReadCloser, error)
type FakeCmd ¶ added in v0.6.0
type FakeCmd struct {
// contains filtered or unexported fields
}
func FakeRunErr ¶ added in v0.31.0
func FakeRunInput ¶ added in v0.31.0
func FakeRunOut ¶ added in v0.31.0
func FakeRunOutErr ¶ added in v0.31.0
func NewFakeCmd ¶ added in v0.6.0
func (*FakeCmd) WithRunErr ¶ added in v0.21.0
func (*FakeCmd) WithRunInput ¶ added in v0.21.0
func (*FakeCmd) WithRunOut ¶ added in v0.21.0
type T ¶ added in v0.31.0
func (*T) CheckContains ¶ added in v0.31.0
func (*T) CheckDeepEqual ¶ added in v0.31.0
func (*T) CheckError ¶ added in v0.31.0
func (*T) CheckErrorAndDeepEqual ¶ added in v0.31.0
func (*T) CheckErrorAndTypeEquality ¶ added in v0.31.0
func (*T) CheckErrorContains ¶ added in v0.31.0
CheckErrorContains checks that an error is not nil and contains a given message.
func (*T) CheckNoError ¶ added in v0.31.0
func (*T) FakeRunOut ¶ added in v0.31.0
func (*T) FakeRunOutErr ¶ added in v0.31.0
func (*T) NewTempDir ¶ added in v0.31.0
func (*T) SetEnvs ¶ added in v0.31.0
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.
func (*T) SetupFakeKubernetesContext ¶ added in v0.31.0
SetupFakeKubernetesContext replaces the current kubernetes configuration file to setup a fixed current context.
type TempDir ¶ added in v0.3.0
type TempDir struct {
// contains filtered or unexported fields
}
TempDir offers actions on a temp directory.
func NewTempDir ¶ added in v0.12.0
NewTempDir creates a temporary directory and a teardown function that should be called to properly delete the directory content.
func (*TempDir) Chtimes ¶ added in v0.12.0
Chtimes changes the times for a file in the temp directory.
func (*TempDir) Paths ¶ added in v0.26.0
Paths returns the paths to a list of files in the temp directory.