Documentation ¶
Index ¶
- func Chdir(t *testing.T, dir string) func()
- 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 CheckErrorAndTypeEquality(t *testing.T, shouldErr bool, err error, expected, actual interface{})
- func CheckErrorContains(t *testing.T, message string, err error)
- func CreateTempFileWithContents(t *testing.T, dir string, name string, content []byte) string
- func ServeFile(t *testing.T, content []byte) (url string, tearDown func())
- func SetEnvs(t *testing.T, envs map[string]string) func(*testing.T)
- func SetupFakeKubernetesContext(t *testing.T, config api.Config) func()
- 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 (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 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) Write(file, content string) *TempDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckContains ¶
func CheckDeepEqual ¶
func CheckErrorAndDeepEqual ¶
func CheckErrorContains ¶
CheckErrorContains checks that an error is not nil and contains a given message.
func CreateTempFileWithContents ¶
CreateTempFileWithContents creates a temporary file in the dir specified or os.TempDir by default with contents mentioned.
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 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.
func SetupFakeKubernetesContext ¶
SetupFakeKubernetesContext replaces the current kubernetes configuration file to setup a fixed current context.
Types ¶
type FakeAPIClient ¶
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 Pushed []string PushedImages []string // contains filtered or unexported fields }
func (*FakeAPIClient) Close ¶
func (f *FakeAPIClient) Close() error
func (*FakeAPIClient) ImageBuild ¶
func (f *FakeAPIClient) ImageBuild(_ context.Context, _ io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
func (*FakeAPIClient) ImageInspectWithRaw ¶
func (f *FakeAPIClient) ImageInspectWithRaw(_ context.Context, ref string) (types.ImageInspect, []byte, error)
func (*FakeAPIClient) ImageList ¶
func (f *FakeAPIClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
func (*FakeAPIClient) ImagePull ¶
func (f *FakeAPIClient) ImagePull(_ context.Context, ref string, _ types.ImagePullOptions) (io.ReadCloser, error)
func (*FakeAPIClient) ImagePush ¶
func (f *FakeAPIClient) ImagePush(_ context.Context, ref string, _ types.ImagePushOptions) (io.ReadCloser, error)
type FakeCmd ¶
type FakeCmd struct {
// contains filtered or unexported fields
}
func NewFakeCmd ¶
func (*FakeCmd) WithRunInput ¶
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.