dockertest

package
v0.14.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MockCogConfig string = "" /* 193-byte string literal not displayed */
View Source
var MockOpenAPISchema string = "{}"
View Source
var PushError error = nil

Functions

func ImageRef added in v0.14.8

func ImageRef(t *testing.T, label string) string

ImageRef returns an reference based on the unique test name and label. If the label is empty, it will default to "test-" followed by the current unix epoch time.

func ImageRefWithRegistry added in v0.14.8

func ImageRefWithRegistry(t *testing.T, registryAddr string, label string) string

Types

type HelperClient added in v0.14.8

type HelperClient struct {
	Client *client.Client
}

func NewHelperClient added in v0.14.8

func NewHelperClient(t testing.TB) *HelperClient

NewHelperClient returns a Docker client for testing. It skips the test if Docker is not available.

func (*HelperClient) CleanupImage added in v0.14.8

func (c *HelperClient) CleanupImage(t testing.TB, imageRef string)

func (*HelperClient) CleanupImages added in v0.14.8

func (c *HelperClient) CleanupImages(t testing.TB)

func (*HelperClient) Close added in v0.14.8

func (c *HelperClient) Close() error

func (*HelperClient) DeleteImage added in v0.14.8

func (c *HelperClient) DeleteImage(t testing.TB, imageRef string) error

func (*HelperClient) ImageExists added in v0.14.8

func (c *HelperClient) ImageExists(t testing.TB, imageRef string) bool

func (*HelperClient) InspectContainer added in v0.14.8

func (c *HelperClient) InspectContainer(t testing.TB, containerID string) *container.InspectResponse

func (*HelperClient) InspectImage added in v0.14.8

func (c *HelperClient) InspectImage(t testing.TB, imageRef string) *image.InspectResponse

func (*HelperClient) LoadImageFixture added in v0.14.8

func (c *HelperClient) LoadImageFixture(t testing.TB, name string, tag string)

func (*HelperClient) MustDeleteImage added in v0.14.8

func (c *HelperClient) MustDeleteImage(t testing.TB, imageRef string)

func (*HelperClient) MustPullImage added in v0.14.8

func (c *HelperClient) MustPullImage(t testing.TB, ref string)

func (*HelperClient) MustPushImage added in v0.14.8

func (c *HelperClient) MustPushImage(t testing.TB, ref string)

func (*HelperClient) PullImage added in v0.14.8

func (c *HelperClient) PullImage(t testing.TB, ref string) error

func (*HelperClient) PushImage added in v0.14.8

func (c *HelperClient) PushImage(t testing.TB, ref string) error

func (*HelperClient) RunContainer added in v0.14.8

func (c *HelperClient) RunContainer(t testing.TB, imageName string) string

func (*HelperClient) StopContainer added in v0.14.8

func (c *HelperClient) StopContainer(t testing.TB, containerID string)

type MockCommand

type MockCommand struct{}

func NewMockCommand

func NewMockCommand() *MockCommand

func (*MockCommand) ContainerInspect added in v0.14.8

func (c *MockCommand) ContainerInspect(ctx context.Context, id string) (*container.InspectResponse, error)

func (*MockCommand) ContainerLogs added in v0.14.8

func (c *MockCommand) ContainerLogs(ctx context.Context, containerID string, w io.Writer) error

func (*MockCommand) ContainerStart added in v0.14.11

func (c *MockCommand) ContainerStart(ctx context.Context, options command.RunOptions) (string, error)

func (*MockCommand) ContainerStop added in v0.14.8

func (c *MockCommand) ContainerStop(ctx context.Context, containerID string) error

func (*MockCommand) CreateAptTarFile

func (c *MockCommand) CreateAptTarFile(ctx context.Context, tmpDir string, aptTarFile string, packages ...string) (string, error)

func (*MockCommand) CreateTarFile

func (c *MockCommand) CreateTarFile(ctx context.Context, image string, tmpDir string, tarFile string, folder string) (string, error)

func (*MockCommand) ImageBuild added in v0.14.9

func (c *MockCommand) ImageBuild(ctx context.Context, options command.ImageBuildOptions) error

func (*MockCommand) ImageExists added in v0.14.8

func (c *MockCommand) ImageExists(ctx context.Context, ref string) (bool, error)

func (*MockCommand) Inspect

func (c *MockCommand) Inspect(ctx context.Context, ref string) (*image.InspectResponse, error)

func (*MockCommand) LoadUserInformation

func (c *MockCommand) LoadUserInformation(ctx context.Context, registryHost string) (*command.UserInfo, error)

func (*MockCommand) Pull

func (c *MockCommand) Pull(ctx context.Context, image string, force bool) (*image.InspectResponse, error)

func (*MockCommand) Push

func (c *MockCommand) Push(ctx context.Context, image string) error

func (*MockCommand) Run added in v0.14.11

func (c *MockCommand) Run(ctx context.Context, options command.RunOptions) error

type MockCommand2 added in v0.14.11

type MockCommand2 struct {
	mock.Mock
}

MockCommand2 is an autogenerated mock type for the Command type

func NewMockCommand2 added in v0.14.11

func NewMockCommand2(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCommand2

NewMockCommand2 creates a new instance of MockCommand2. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCommand2) ContainerInspect added in v0.14.11

func (_mock *MockCommand2) ContainerInspect(ctx context.Context, id string) (*container.InspectResponse, error)

ContainerInspect provides a mock function for the type MockCommand2

func (*MockCommand2) ContainerLogs added in v0.14.11

func (_mock *MockCommand2) ContainerLogs(ctx context.Context, containerID string, w io.Writer) error

ContainerLogs provides a mock function for the type MockCommand2

func (*MockCommand2) ContainerStart added in v0.14.11

func (_mock *MockCommand2) ContainerStart(ctx context.Context, options command.RunOptions) (string, error)

ContainerStart provides a mock function for the type MockCommand2

func (*MockCommand2) ContainerStop added in v0.14.11

func (_mock *MockCommand2) ContainerStop(ctx context.Context, containerID string) error

ContainerStop provides a mock function for the type MockCommand2

func (*MockCommand2) CreateAptTarFile added in v0.14.11

func (_mock *MockCommand2) CreateAptTarFile(ctx context.Context, tmpDir string, aptTarFile string, packages ...string) (string, error)

CreateAptTarFile provides a mock function for the type MockCommand2

func (*MockCommand2) CreateTarFile added in v0.14.11

func (_mock *MockCommand2) CreateTarFile(ctx context.Context, ref string, tmpDir string, tarFile string, folder string) (string, error)

CreateTarFile provides a mock function for the type MockCommand2

func (*MockCommand2) EXPECT added in v0.14.11

func (_m *MockCommand2) EXPECT() *MockCommand2_Expecter

func (*MockCommand2) ImageBuild added in v0.14.11

func (_mock *MockCommand2) ImageBuild(ctx context.Context, options command.ImageBuildOptions) error

ImageBuild provides a mock function for the type MockCommand2

func (*MockCommand2) ImageExists added in v0.14.11

func (_mock *MockCommand2) ImageExists(ctx context.Context, ref string) (bool, error)

ImageExists provides a mock function for the type MockCommand2

func (*MockCommand2) Inspect added in v0.14.11

func (_mock *MockCommand2) Inspect(ctx context.Context, ref string) (*image.InspectResponse, error)

Inspect provides a mock function for the type MockCommand2

func (*MockCommand2) LoadUserInformation added in v0.14.11

func (_mock *MockCommand2) LoadUserInformation(ctx context.Context, registryHost string) (*command.UserInfo, error)

LoadUserInformation provides a mock function for the type MockCommand2

func (*MockCommand2) Pull added in v0.14.11

func (_mock *MockCommand2) Pull(ctx context.Context, ref string, force bool) (*image.InspectResponse, error)

Pull provides a mock function for the type MockCommand2

func (*MockCommand2) Push added in v0.14.11

func (_mock *MockCommand2) Push(ctx context.Context, ref string) error

Push provides a mock function for the type MockCommand2

func (*MockCommand2) Run added in v0.14.11

func (_mock *MockCommand2) Run(ctx context.Context, options command.RunOptions) error

Run provides a mock function for the type MockCommand2

type MockCommand2_ContainerInspect_Call added in v0.14.11

type MockCommand2_ContainerInspect_Call struct {
	*mock.Call
}

MockCommand2_ContainerInspect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContainerInspect'

func (*MockCommand2_ContainerInspect_Call) Return added in v0.14.11

func (*MockCommand2_ContainerInspect_Call) Run added in v0.14.11

func (*MockCommand2_ContainerInspect_Call) RunAndReturn added in v0.14.11

type MockCommand2_ContainerLogs_Call added in v0.14.11

type MockCommand2_ContainerLogs_Call struct {
	*mock.Call
}

MockCommand2_ContainerLogs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContainerLogs'

func (*MockCommand2_ContainerLogs_Call) Return added in v0.14.11

func (*MockCommand2_ContainerLogs_Call) Run added in v0.14.11

func (*MockCommand2_ContainerLogs_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_ContainerLogs_Call) RunAndReturn(run func(ctx context.Context, containerID string, w io.Writer) error) *MockCommand2_ContainerLogs_Call

type MockCommand2_ContainerStart_Call added in v0.14.11

type MockCommand2_ContainerStart_Call struct {
	*mock.Call
}

MockCommand2_ContainerStart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContainerStart'

func (*MockCommand2_ContainerStart_Call) Return added in v0.14.11

func (*MockCommand2_ContainerStart_Call) Run added in v0.14.11

func (*MockCommand2_ContainerStart_Call) RunAndReturn added in v0.14.11

type MockCommand2_ContainerStop_Call added in v0.14.11

type MockCommand2_ContainerStop_Call struct {
	*mock.Call
}

MockCommand2_ContainerStop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContainerStop'

func (*MockCommand2_ContainerStop_Call) Return added in v0.14.11

func (*MockCommand2_ContainerStop_Call) Run added in v0.14.11

func (*MockCommand2_ContainerStop_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_ContainerStop_Call) RunAndReturn(run func(ctx context.Context, containerID string) error) *MockCommand2_ContainerStop_Call

type MockCommand2_CreateAptTarFile_Call added in v0.14.11

type MockCommand2_CreateAptTarFile_Call struct {
	*mock.Call
}

MockCommand2_CreateAptTarFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAptTarFile'

func (*MockCommand2_CreateAptTarFile_Call) Return added in v0.14.11

func (*MockCommand2_CreateAptTarFile_Call) Run added in v0.14.11

func (_c *MockCommand2_CreateAptTarFile_Call) Run(run func(ctx context.Context, tmpDir string, aptTarFile string, packages ...string)) *MockCommand2_CreateAptTarFile_Call

func (*MockCommand2_CreateAptTarFile_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_CreateAptTarFile_Call) RunAndReturn(run func(ctx context.Context, tmpDir string, aptTarFile string, packages ...string) (string, error)) *MockCommand2_CreateAptTarFile_Call

type MockCommand2_CreateTarFile_Call added in v0.14.11

type MockCommand2_CreateTarFile_Call struct {
	*mock.Call
}

MockCommand2_CreateTarFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateTarFile'

func (*MockCommand2_CreateTarFile_Call) Return added in v0.14.11

func (*MockCommand2_CreateTarFile_Call) Run added in v0.14.11

func (_c *MockCommand2_CreateTarFile_Call) Run(run func(ctx context.Context, ref string, tmpDir string, tarFile string, folder string)) *MockCommand2_CreateTarFile_Call

func (*MockCommand2_CreateTarFile_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_CreateTarFile_Call) RunAndReturn(run func(ctx context.Context, ref string, tmpDir string, tarFile string, folder string) (string, error)) *MockCommand2_CreateTarFile_Call

type MockCommand2_Expecter added in v0.14.11

type MockCommand2_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockCommand2_Expecter) ContainerInspect added in v0.14.11

func (_e *MockCommand2_Expecter) ContainerInspect(ctx interface{}, id interface{}) *MockCommand2_ContainerInspect_Call

ContainerInspect is a helper method to define mock.On call

  • ctx
  • id

func (*MockCommand2_Expecter) ContainerLogs added in v0.14.11

func (_e *MockCommand2_Expecter) ContainerLogs(ctx interface{}, containerID interface{}, w interface{}) *MockCommand2_ContainerLogs_Call

ContainerLogs is a helper method to define mock.On call

  • ctx
  • containerID
  • w

func (*MockCommand2_Expecter) ContainerStart added in v0.14.11

func (_e *MockCommand2_Expecter) ContainerStart(ctx interface{}, options interface{}) *MockCommand2_ContainerStart_Call

ContainerStart is a helper method to define mock.On call

  • ctx
  • options

func (*MockCommand2_Expecter) ContainerStop added in v0.14.11

func (_e *MockCommand2_Expecter) ContainerStop(ctx interface{}, containerID interface{}) *MockCommand2_ContainerStop_Call

ContainerStop is a helper method to define mock.On call

  • ctx
  • containerID

func (*MockCommand2_Expecter) CreateAptTarFile added in v0.14.11

func (_e *MockCommand2_Expecter) CreateAptTarFile(ctx interface{}, tmpDir interface{}, aptTarFile interface{}, packages ...interface{}) *MockCommand2_CreateAptTarFile_Call

CreateAptTarFile is a helper method to define mock.On call

  • ctx
  • tmpDir
  • aptTarFile
  • packages

func (*MockCommand2_Expecter) CreateTarFile added in v0.14.11

func (_e *MockCommand2_Expecter) CreateTarFile(ctx interface{}, ref interface{}, tmpDir interface{}, tarFile interface{}, folder interface{}) *MockCommand2_CreateTarFile_Call

CreateTarFile is a helper method to define mock.On call

  • ctx
  • ref
  • tmpDir
  • tarFile
  • folder

func (*MockCommand2_Expecter) ImageBuild added in v0.14.11

func (_e *MockCommand2_Expecter) ImageBuild(ctx interface{}, options interface{}) *MockCommand2_ImageBuild_Call

ImageBuild is a helper method to define mock.On call

  • ctx
  • options

func (*MockCommand2_Expecter) ImageExists added in v0.14.11

func (_e *MockCommand2_Expecter) ImageExists(ctx interface{}, ref interface{}) *MockCommand2_ImageExists_Call

ImageExists is a helper method to define mock.On call

  • ctx
  • ref

func (*MockCommand2_Expecter) Inspect added in v0.14.11

func (_e *MockCommand2_Expecter) Inspect(ctx interface{}, ref interface{}) *MockCommand2_Inspect_Call

Inspect is a helper method to define mock.On call

  • ctx
  • ref

func (*MockCommand2_Expecter) LoadUserInformation added in v0.14.11

func (_e *MockCommand2_Expecter) LoadUserInformation(ctx interface{}, registryHost interface{}) *MockCommand2_LoadUserInformation_Call

LoadUserInformation is a helper method to define mock.On call

  • ctx
  • registryHost

func (*MockCommand2_Expecter) Pull added in v0.14.11

func (_e *MockCommand2_Expecter) Pull(ctx interface{}, ref interface{}, force interface{}) *MockCommand2_Pull_Call

Pull is a helper method to define mock.On call

  • ctx
  • ref
  • force

func (*MockCommand2_Expecter) Push added in v0.14.11

func (_e *MockCommand2_Expecter) Push(ctx interface{}, ref interface{}) *MockCommand2_Push_Call

Push is a helper method to define mock.On call

  • ctx
  • ref

func (*MockCommand2_Expecter) Run added in v0.14.11

func (_e *MockCommand2_Expecter) Run(ctx interface{}, options interface{}) *MockCommand2_Run_Call

Run is a helper method to define mock.On call

  • ctx
  • options

type MockCommand2_ImageBuild_Call added in v0.14.11

type MockCommand2_ImageBuild_Call struct {
	*mock.Call
}

MockCommand2_ImageBuild_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ImageBuild'

func (*MockCommand2_ImageBuild_Call) Return added in v0.14.11

func (*MockCommand2_ImageBuild_Call) Run added in v0.14.11

func (*MockCommand2_ImageBuild_Call) RunAndReturn added in v0.14.11

type MockCommand2_ImageExists_Call added in v0.14.11

type MockCommand2_ImageExists_Call struct {
	*mock.Call
}

MockCommand2_ImageExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ImageExists'

func (*MockCommand2_ImageExists_Call) Return added in v0.14.11

func (*MockCommand2_ImageExists_Call) Run added in v0.14.11

func (*MockCommand2_ImageExists_Call) RunAndReturn added in v0.14.11

type MockCommand2_Inspect_Call added in v0.14.11

type MockCommand2_Inspect_Call struct {
	*mock.Call
}

MockCommand2_Inspect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Inspect'

func (*MockCommand2_Inspect_Call) Return added in v0.14.11

func (*MockCommand2_Inspect_Call) Run added in v0.14.11

func (*MockCommand2_Inspect_Call) RunAndReturn added in v0.14.11

type MockCommand2_LoadUserInformation_Call added in v0.14.11

type MockCommand2_LoadUserInformation_Call struct {
	*mock.Call
}

MockCommand2_LoadUserInformation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadUserInformation'

func (*MockCommand2_LoadUserInformation_Call) Return added in v0.14.11

func (*MockCommand2_LoadUserInformation_Call) Run added in v0.14.11

func (*MockCommand2_LoadUserInformation_Call) RunAndReturn added in v0.14.11

type MockCommand2_Pull_Call added in v0.14.11

type MockCommand2_Pull_Call struct {
	*mock.Call
}

MockCommand2_Pull_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pull'

func (*MockCommand2_Pull_Call) Return added in v0.14.11

func (_c *MockCommand2_Pull_Call) Return(inspectResponse *image.InspectResponse, err error) *MockCommand2_Pull_Call

func (*MockCommand2_Pull_Call) Run added in v0.14.11

func (_c *MockCommand2_Pull_Call) Run(run func(ctx context.Context, ref string, force bool)) *MockCommand2_Pull_Call

func (*MockCommand2_Pull_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_Pull_Call) RunAndReturn(run func(ctx context.Context, ref string, force bool) (*image.InspectResponse, error)) *MockCommand2_Pull_Call

type MockCommand2_Push_Call added in v0.14.11

type MockCommand2_Push_Call struct {
	*mock.Call
}

MockCommand2_Push_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Push'

func (*MockCommand2_Push_Call) Return added in v0.14.11

func (*MockCommand2_Push_Call) Run added in v0.14.11

func (*MockCommand2_Push_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_Push_Call) RunAndReturn(run func(ctx context.Context, ref string) error) *MockCommand2_Push_Call

type MockCommand2_Run_Call added in v0.14.11

type MockCommand2_Run_Call struct {
	*mock.Call
}

MockCommand2_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run'

func (*MockCommand2_Run_Call) Return added in v0.14.11

func (*MockCommand2_Run_Call) Run added in v0.14.11

func (*MockCommand2_Run_Call) RunAndReturn added in v0.14.11

func (_c *MockCommand2_Run_Call) RunAndReturn(run func(ctx context.Context, options command.RunOptions) error) *MockCommand2_Run_Call

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL