Documentation ¶
Index ¶
- func AsMap(args ...interface{}) map[string]interface{}
- func Containers(containers ...types.Container) []types.Container
- func DetailsResponse(params map[string]interface{}) types.ContainerJSON
- func HTTPClient(daemonURL string, tlsConfig *tls.Config) (*http.Client, error)
- func ImageDetailsResponse(params map[string]interface{}) types.ImageInspect
- func Response(params map[string]interface{}) types.Container
- type Client
- type Container
- func CreateLabeledTestContainers(count int, labels map[string]string) []*Container
- func CreateTestContainers(count int) []*Container
- func ListNContainers(ctx context.Context, client Client, names []string, pattern string, ...) ([]*Container, error)
- func RandomContainer(containers []*Container) *Container
- type FilterFunc
- type ListOpts
- type MockClient
- func (_m *MockClient) ExecContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 bool) error
- func (_m *MockClient) KillContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 bool) error
- func (_m *MockClient) ListContainers(_a0 context.Context, _a1 FilterFunc, _a2 ListOpts) ([]*Container, error)
- func (_m *MockClient) NetemContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 []string, ...) error
- func (_m *MockClient) PauseContainer(_a0 context.Context, _a1 *Container, _a2 bool) error
- func (_m *MockClient) RemoveContainer(_a0 context.Context, _a1 *Container, _a2 bool, _a3 bool, _a4 bool, _a5 bool) error
- func (_m *MockClient) RestartContainer(_a0 context.Context, _a1 *Container, _a2 time.Duration, _a3 bool) error
- func (_m *MockClient) StartContainer(_a0 context.Context, _a1 *Container, _a2 bool) error
- func (_m *MockClient) StopContainer(_a0 context.Context, _a1 *Container, _a2 int, _a3 bool) error
- func (_m *MockClient) StopContainerWithID(_a0 context.Context, _a1 string, _a2 time.Duration, _a3 bool) error
- func (_m *MockClient) StopNetemContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 []*net.IPNet, ...) error
- func (_m *MockClient) StressContainer(_a0 context.Context, _a1 *Container, _a2 []string, _a3 string, _a4 bool, ...) (string, <-chan string, <-chan error, error)
- func (_m *MockClient) UnpauseContainer(_a0 context.Context, _a1 *Container, _a2 bool) error
- type MockFilterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsMap ¶
func AsMap(args ...interface{}) map[string]interface{}
AsMap convert multiple arguments into map[string]interface{}
func Containers ¶
Containers list of containers
func DetailsResponse ¶
func DetailsResponse(params map[string]interface{}) types.ContainerJSON
DetailsResponse mock container details response
func HTTPClient ¶
HTTPClient create new http client to connect to the docker daemon
func ImageDetailsResponse ¶
func ImageDetailsResponse(params map[string]interface{}) types.ImageInspect
ImageDetailsResponse mock image response
Types ¶
type Client ¶
type Client interface { ListContainers(context.Context, FilterFunc, ListOpts) ([]*Container, error) StopContainer(context.Context, *Container, int, bool) error KillContainer(context.Context, *Container, string, bool) error ExecContainer(context.Context, *Container, string, bool) error RestartContainer(context.Context, *Container, time.Duration, bool) error RemoveContainer(context.Context, *Container, bool, bool, bool, bool) error NetemContainer(context.Context, *Container, string, []string, []*net.IPNet, []string, []string, time.Duration, string, bool, bool) error StopNetemContainer(context.Context, *Container, string, []*net.IPNet, []string, []string, string, bool, bool) error PauseContainer(context.Context, *Container, bool) error UnpauseContainer(context.Context, *Container, bool) error StartContainer(context.Context, *Container, bool) error StressContainer(context.Context, *Container, []string, string, bool, time.Duration, bool) (string, <-chan string, <-chan error, error) StopContainerWithID(context.Context, string, time.Duration, bool) error }
Client interface
type Container ¶
type Container struct { ContainerInfo types.ContainerJSON ImageInfo types.ImageInspect }
Container represents a running Docker container.
func CreateLabeledTestContainers ¶
CreateLabeledTestContainers generate test containers with labels
func CreateTestContainers ¶
CreateTestContainers create test container
func ListNContainers ¶
func ListNContainers(ctx context.Context, client Client, names []string, pattern string, labels []string, limit int) ([]*Container, error)
ListNContainers list containers up to specified limit
func RandomContainer ¶
RandomContainer select random container
func (*Container) ImageID ¶
ImageID returns the ID of the Docker image that was used to start the container.
func (*Container) ImageName ¶
ImageName returns the name of the Docker image that was used to start the container. If the original image was specified without a particular tag, the "latest" tag is assumed.
func (*Container) IsPumba ¶
IsPumba returns a boolean flag indicating whether or not the current container is the Pumba container itself. The Pumba container is identified by the presence of the "com.gaiaadm.pumba" label in the container metadata.
func (*Container) IsPumbaSkip ¶
IsPumbaSkip returns a boolean flag indicating whether or not the current container should be ignored by Pumba. This container is identified by the presence of the "com.gaiaadm.pumba.skip" label in the container metadata. Use it to skip monitoring and helper containers.
func (*Container) Links ¶
Links returns a list containing the names of all the containers to which this container is linked.
func (*Container) StopSignal ¶
StopSignal returns the custom stop signal (if any) that is encoded in the container's metadata. If the container has not specified a custom stop signal, the empty string "" is returned.
type FilterFunc ¶
A FilterFunc is a prototype for a function that can be used to filter the results from a call to the ListContainers() method on the Client.
type MockClient ¶
MockClient is an autogenerated mock type for the Client type
func NewMockClient ¶
func NewMockClient(t interface { mock.TestingT Cleanup(func()) }) *MockClient
NewMockClient creates a new instance of MockClient. 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 (*MockClient) ExecContainer ¶
func (_m *MockClient) ExecContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 bool) error
ExecContainer provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockClient) KillContainer ¶
func (_m *MockClient) KillContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 bool) error
KillContainer provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockClient) ListContainers ¶
func (_m *MockClient) ListContainers(_a0 context.Context, _a1 FilterFunc, _a2 ListOpts) ([]*Container, error)
ListContainers provides a mock function with given fields: _a0, _a1, _a2
func (*MockClient) NetemContainer ¶
func (_m *MockClient) NetemContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 []string, _a4 []*net.IPNet, _a5 []string, _a6 []string, _a7 time.Duration, _a8 string, _a9 bool, _a10 bool) error
NetemContainer provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10
func (*MockClient) PauseContainer ¶
PauseContainer provides a mock function with given fields: _a0, _a1, _a2
func (*MockClient) RemoveContainer ¶
func (_m *MockClient) RemoveContainer(_a0 context.Context, _a1 *Container, _a2 bool, _a3 bool, _a4 bool, _a5 bool) error
RemoveContainer provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5
func (*MockClient) RestartContainer ¶
func (_m *MockClient) RestartContainer(_a0 context.Context, _a1 *Container, _a2 time.Duration, _a3 bool) error
RestartContainer provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockClient) StartContainer ¶
StartContainer provides a mock function with given fields: _a0, _a1, _a2
func (*MockClient) StopContainer ¶
StopContainer provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockClient) StopContainerWithID ¶
func (_m *MockClient) StopContainerWithID(_a0 context.Context, _a1 string, _a2 time.Duration, _a3 bool) error
StopContainerWithID provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockClient) StopNetemContainer ¶
func (_m *MockClient) StopNetemContainer(_a0 context.Context, _a1 *Container, _a2 string, _a3 []*net.IPNet, _a4 []string, _a5 []string, _a6 string, _a7 bool, _a8 bool) error
StopNetemContainer provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8
func (*MockClient) StressContainer ¶
func (_m *MockClient) StressContainer(_a0 context.Context, _a1 *Container, _a2 []string, _a3 string, _a4 bool, _a5 time.Duration, _a6 bool) (string, <-chan string, <-chan error, error)
StressContainer provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5, _a6
func (*MockClient) UnpauseContainer ¶
UnpauseContainer provides a mock function with given fields: _a0, _a1, _a2
type MockFilterFunc ¶
MockFilterFunc is an autogenerated mock type for the FilterFunc type
func NewMockFilterFunc ¶
func NewMockFilterFunc(t interface { mock.TestingT Cleanup(func()) }) *MockFilterFunc
NewMockFilterFunc creates a new instance of MockFilterFunc. 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 (*MockFilterFunc) Execute ¶
func (_m *MockFilterFunc) Execute(_a0 *Container) bool
Execute provides a mock function with given fields: _a0