mock

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher struct {
	// ContainerIDFunc mocks the ContainerID method.
	ContainerIDFunc func() string

	// ExecFunc mocks the Exec method.
	ExecFunc func(ctx context.Context, cmd ...string) ([]byte, error)

	// LogFunc mocks the Log method.
	LogFunc func(ctx context.Context) (io.ReadCloser, error)

	// PortsFunc mocks the Ports method.
	PortsFunc func() nat.PortMap

	// StatusFunc mocks the Status method.
	StatusFunc func(ctx context.Context) (*types.ContainerState, error)
	// contains filtered or unexported fields
}

Fetcher is a mock implementation of wait.Fetcher.

func TestSomethingThatUsesFetcher(t *testing.T) {

	// make and configure a mocked wait.Fetcher
	mockedFetcher := &Fetcher{
		ContainerIDFunc: func() string {
			panic("mock out the ContainerID method")
		},
		ExecFunc: func(ctx context.Context, cmd ...string) ([]byte, error) {
			panic("mock out the Exec method")
		},
		LogFunc: func(ctx context.Context) (io.ReadCloser, error) {
			panic("mock out the Log method")
		},
		PortsFunc: func() nat.PortMap {
			panic("mock out the Ports method")
		},
		StatusFunc: func(ctx context.Context) (*types.ContainerState, error) {
			panic("mock out the Status method")
		},
	}

	// use mockedFetcher in code that requires wait.Fetcher
	// and then make assertions.

}

func (*Fetcher) ContainerID added in v0.4.0

func (mock *Fetcher) ContainerID() string

ContainerID calls ContainerIDFunc.

func (*Fetcher) ContainerIDCalls added in v0.4.0

func (mock *Fetcher) ContainerIDCalls() []struct {
}

ContainerIDCalls gets all the calls that were made to ContainerID. Check the length with:

len(mockedFetcher.ContainerIDCalls())

func (*Fetcher) Exec added in v1.3.2

func (mock *Fetcher) Exec(ctx context.Context, cmd ...string) ([]byte, error)

Exec calls ExecFunc.

func (*Fetcher) ExecCalls added in v1.3.2

func (mock *Fetcher) ExecCalls() []struct {
	Ctx context.Context
	Cmd []string
}

ExecCalls gets all the calls that were made to Exec. Check the length with:

len(mockedFetcher.ExecCalls())

func (*Fetcher) Log

func (mock *Fetcher) Log(ctx context.Context) (io.ReadCloser, error)

Log calls LogFunc.

func (*Fetcher) LogCalls

func (mock *Fetcher) LogCalls() []struct {
	Ctx context.Context
}

LogCalls gets all the calls that were made to Log. Check the length with:

len(mockedFetcher.LogCalls())

func (*Fetcher) Ports

func (mock *Fetcher) Ports() nat.PortMap

Ports calls PortsFunc.

func (*Fetcher) PortsCalls

func (mock *Fetcher) PortsCalls() []struct {
}

PortsCalls gets all the calls that were made to Ports. Check the length with:

len(mockedFetcher.PortsCalls())

func (*Fetcher) Status

func (mock *Fetcher) Status(ctx context.Context) (*types.ContainerState, error)

Status calls StatusFunc.

func (*Fetcher) StatusCalls

func (mock *Fetcher) StatusCalls() []struct {
	Ctx context.Context
}

StatusCalls gets all the calls that were made to Status. Check the length with:

len(mockedFetcher.StatusCalls())

Jump to

Keyboard shortcuts

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