Documentation
¶
Index ¶
- func EnsureNetwork(ctx context.Context, c Client, name string) error
- type Client
- type DockerClient
- func (c *DockerClient) Close() error
- func (c *DockerClient) ContainerInspect(ctx context.Context, id string) (container.InspectResponse, error)
- func (c *DockerClient) ContainerList(ctx context.Context, opts container.ListOptions) ([]container.Summary, error)
- func (c *DockerClient) ContainerLogs(ctx context.Context, containerID string, opts container.LogsOptions) (io.ReadCloser, error)
- func (c *DockerClient) ContainerStats(ctx context.Context, id string) (container.StatsResponseReader, error)
- func (c *DockerClient) NetworkCreate(ctx context.Context, name string, opts network.CreateOptions) (network.CreateResponse, error)
- func (c *DockerClient) NetworkInspect(ctx context.Context, id string) (network.Inspect, error)
- func (c *DockerClient) Ping(ctx context.Context) error
- func (c *DockerClient) Raw() *dockerclient.Client
- type MockClient
- func (m *MockClient) AddContainer(id string, labels map[string]string)
- func (m *MockClient) Close() error
- func (m *MockClient) ContainerInspect(ctx context.Context, id string) (container.InspectResponse, error)
- func (m *MockClient) ContainerList(_ context.Context, _ container.ListOptions) ([]container.Summary, error)
- func (m *MockClient) ContainerLogs(_ context.Context, id string, _ container.LogsOptions) (io.ReadCloser, error)
- func (m *MockClient) ContainerStats(_ context.Context, _ string) (container.StatsResponseReader, error)
- func (m *MockClient) HasCall(prefix string) bool
- func (m *MockClient) NetworkCreate(ctx context.Context, name string, opts network.CreateOptions) (network.CreateResponse, error)
- func (m *MockClient) NetworkInspect(ctx context.Context, id string) (network.Inspect, error)
- func (m *MockClient) Ping(_ context.Context) error
- func (m *MockClient) Raw() *dockerclient.Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface {
Ping(ctx context.Context) error
Close() error
ContainerList(ctx context.Context, opts container.ListOptions) ([]container.Summary, error)
ContainerStats(ctx context.Context, containerID string) (container.StatsResponseReader, error)
ContainerLogs(ctx context.Context, containerID string, opts container.LogsOptions) (io.ReadCloser, error)
ContainerInspect(ctx context.Context, id string) (container.InspectResponse, error)
NetworkInspect(ctx context.Context, id string) (network.Inspect, error)
NetworkCreate(ctx context.Context, name string, opts network.CreateOptions) (network.CreateResponse, error)
Raw() *dockerclient.Client
}
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient() (*DockerClient, error)
func (*DockerClient) Close ¶
func (c *DockerClient) Close() error
func (*DockerClient) ContainerInspect ¶
func (c *DockerClient) ContainerInspect(ctx context.Context, id string) (container.InspectResponse, error)
func (*DockerClient) ContainerList ¶
func (c *DockerClient) ContainerList(ctx context.Context, opts container.ListOptions) ([]container.Summary, error)
func (*DockerClient) ContainerLogs ¶
func (c *DockerClient) ContainerLogs(ctx context.Context, containerID string, opts container.LogsOptions) (io.ReadCloser, error)
func (*DockerClient) ContainerStats ¶
func (c *DockerClient) ContainerStats(ctx context.Context, id string) (container.StatsResponseReader, error)
func (*DockerClient) NetworkCreate ¶
func (c *DockerClient) NetworkCreate(ctx context.Context, name string, opts network.CreateOptions) (network.CreateResponse, error)
func (*DockerClient) NetworkInspect ¶
func (*DockerClient) Raw ¶
func (c *DockerClient) Raw() *dockerclient.Client
type MockClient ¶
type MockClient struct {
Calls []string
// Optional overrides for test setup.
NetworkInspectFn func(ctx context.Context, id string) (network.Inspect, error)
NetworkCreateFn func(ctx context.Context, name string, opts network.CreateOptions) (network.CreateResponse, error)
ContainerInspectFn func(ctx context.Context, id string) (container.InspectResponse, error)
// contains filtered or unexported fields
}
MockClient is a thread-safe in-memory Docker client for testing.
func NewMockClient ¶
func NewMockClient() *MockClient
func (*MockClient) AddContainer ¶
func (m *MockClient) AddContainer(id string, labels map[string]string)
AddContainer pre-populates the mock with a container for testing.
func (*MockClient) Close ¶
func (m *MockClient) Close() error
func (*MockClient) ContainerInspect ¶
func (m *MockClient) ContainerInspect(ctx context.Context, id string) (container.InspectResponse, error)
func (*MockClient) ContainerList ¶
func (m *MockClient) ContainerList(_ context.Context, _ container.ListOptions) ([]container.Summary, error)
func (*MockClient) ContainerLogs ¶
func (m *MockClient) ContainerLogs(_ context.Context, id string, _ container.LogsOptions) (io.ReadCloser, error)
func (*MockClient) ContainerStats ¶
func (m *MockClient) ContainerStats(_ context.Context, _ string) (container.StatsResponseReader, error)
func (*MockClient) HasCall ¶
func (m *MockClient) HasCall(prefix string) bool
HasCall returns true if any recorded call has the given prefix.
func (*MockClient) NetworkCreate ¶
func (m *MockClient) NetworkCreate(ctx context.Context, name string, opts network.CreateOptions) (network.CreateResponse, error)
func (*MockClient) NetworkInspect ¶
func (*MockClient) Raw ¶
func (m *MockClient) Raw() *dockerclient.Client
Click to show internal directories.
Click to hide internal directories.