mocks

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerClientMock

type DockerClientMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func() error

	// ContainerListFunc mocks the ContainerList method.
	ContainerListFunc func(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)

	// ImagePullFunc mocks the ImagePull method.
	ImagePullFunc func(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)

	// ImagePushFunc mocks the ImagePush method.
	ImagePushFunc func(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error)

	// ImageTagFunc mocks the ImageTag method.
	ImageTagFunc func(ctx context.Context, source string, target string) error
	// contains filtered or unexported fields
}

DockerClientMock is a mock implementation of DockerClient.

    func TestSomethingThatUsesDockerClient(t *testing.T) {

        // make and configure a mocked DockerClient
        mockedDockerClient := &DockerClientMock{
            CloseFunc: func() error {
	               panic("mock out the Close method")
            },
            ContainerListFunc: func(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
	               panic("mock out the ContainerList method")
            },
            ImagePullFunc: func(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error) {
	               panic("mock out the ImagePull method")
            },
            ImagePushFunc: func(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error) {
	               panic("mock out the ImagePush method")
            },
            ImageTagFunc: func(ctx context.Context, source string, target string) error {
	               panic("mock out the ImageTag method")
            },
        }

        // use mockedDockerClient in code that requires DockerClient
        // and then make assertions.

    }

func (*DockerClientMock) Close

func (mock *DockerClientMock) Close() error

Close calls CloseFunc.

func (*DockerClientMock) CloseCalls

func (mock *DockerClientMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedDockerClient.CloseCalls())

func (*DockerClientMock) ContainerList

func (mock *DockerClientMock) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)

ContainerList calls ContainerListFunc.

func (*DockerClientMock) ContainerListCalls

func (mock *DockerClientMock) ContainerListCalls() []struct {
	Ctx     context.Context
	Options types.ContainerListOptions
}

ContainerListCalls gets all the calls that were made to ContainerList. Check the length with:

len(mockedDockerClient.ContainerListCalls())

func (*DockerClientMock) ImagePull

func (mock *DockerClientMock) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)

ImagePull calls ImagePullFunc.

func (*DockerClientMock) ImagePullCalls

func (mock *DockerClientMock) ImagePullCalls() []struct {
	Ctx     context.Context
	RefStr  string
	Options types.ImagePullOptions
}

ImagePullCalls gets all the calls that were made to ImagePull. Check the length with:

len(mockedDockerClient.ImagePullCalls())

func (*DockerClientMock) ImagePush

func (mock *DockerClientMock) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error)

ImagePush calls ImagePushFunc.

func (*DockerClientMock) ImagePushCalls

func (mock *DockerClientMock) ImagePushCalls() []struct {
	Ctx     context.Context
	Image   string
	Options types.ImagePushOptions
}

ImagePushCalls gets all the calls that were made to ImagePush. Check the length with:

len(mockedDockerClient.ImagePushCalls())

func (*DockerClientMock) ImageTag

func (mock *DockerClientMock) ImageTag(ctx context.Context, source string, target string) error

ImageTag calls ImageTagFunc.

func (*DockerClientMock) ImageTagCalls

func (mock *DockerClientMock) ImageTagCalls() []struct {
	Ctx    context.Context
	Source string
	Target string
}

ImageTagCalls gets all the calls that were made to ImageTag. Check the length with:

len(mockedDockerClient.ImageTagCalls())

Jump to

Keyboard shortcuts

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