docker

package
v2.0.0-...-62c9930 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
	ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)
	TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)
	Info(ctx context.Context) (types.Info, error)
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
	NetworkInspect(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error)
	NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
	ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error)
	ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error)
	Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
}

Client is an interface with needed functionalities from docker client

func WrapClient

func WrapClient(client *client.Client) Client

WrapClient creates a new docker client wrapper

type ClientMock

type ClientMock struct {
	ContainersData       []types.Container
	ServicesData         []swarm.Service
	ConfigsData          []swarm.Config
	TasksData            []swarm.Task
	NetworksData         []types.NetworkResource
	InfoData             types.Info
	ContainerInspectData map[string]types.ContainerJSON
	NetworkInspectData   map[string]types.NetworkResource
	EventsChannel        chan events.Message
	ErrorsChannel        chan error
}

ClientMock allows easily mocking of docker client data

func (*ClientMock) ConfigInspectWithRaw

func (mock *ClientMock) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error)

ConfigInspectWithRaw return sinformation about a specific config

func (*ClientMock) ConfigList

func (mock *ClientMock) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error)

ConfigList list all configs

func (*ClientMock) ContainerInspect

func (mock *ClientMock) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)

ContainerInspect returns information about a specific container

func (*ClientMock) ContainerList

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

ContainerList list all containers

func (*ClientMock) Events

func (mock *ClientMock) Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)

Events listen for events in docker

func (*ClientMock) Info

func (mock *ClientMock) Info(ctx context.Context) (types.Info, error)

Info retrieves information about docker host

func (*ClientMock) NetworkInspect

func (mock *ClientMock) NetworkInspect(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error)

NetworkInspect returns information about a specific network

func (*ClientMock) NetworkList

func (mock *ClientMock) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)

NetworkList list all networks

func (*ClientMock) ServiceList

func (mock *ClientMock) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error)

ServiceList list all services

func (*ClientMock) TaskList

func (mock *ClientMock) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error)

TaskList list all tasks

type Utils

type Utils interface {
	GetCurrentContainerID() (string, error)
}

Utils is an interface with docker utilities

func CreateUtils

func CreateUtils() Utils

CreateUtils creates a new instance of docker utils

type UtilsMock

type UtilsMock struct {
	MockGetCurrentContainerID func() (string, error)
}

UtilsMock allows mocking docker Utils

func (*UtilsMock) GetCurrentContainerID

func (mock *UtilsMock) GetCurrentContainerID() (string, error)

GetCurrentContainerID returns the id of the container running this application

Jump to

Keyboard shortcuts

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