Documentation ¶
Index ¶
- type ClientInterface
- type FakeClient
- func (fc *FakeClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (fc *FakeClient) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
- func (fc *FakeClient) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
- func (fc *FakeClient) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
- func (fc *FakeClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (fc *FakeClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (fc *FakeClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
- func (fc *FakeClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
- func (fc *FakeClient) ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error)
- func (fc *FakeClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
- func (fc *FakeClient) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
- func (fc *FakeClient) CopyToContainer(ctx context.Context, container, path string, content io.Reader, ...) error
- func (fc *FakeClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
- func (fc *FakeClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
- type Handler
- func (handler *Handler) ContainerRemove(ctx context.Context, srcContainerID string) error
- func (handler *Handler) ContainerStop(ctx context.Context, srcContainerID string) error
- func (handler *Handler) CopyFromContainer(ctx context.Context, srcContainerID string, srcPath string, dstPath string) error
- func (handler *Handler) CopyTestFilesToContainer(ctx context.Context, srcContainerID string, files []string, targetDir string) error
- func (handler *Handler) Execute(ctx context.Context, srcContainerID string, cmd []string) (*types.IDResponse, *types.HijackedResponse, error)
- func (handler *Handler) ExecuteInspect(ctx context.Context, srcContainerID string) (int, error)
- func (handler *Handler) HasBaseImage(ctx context.Context, baseImage string) (bool, error)
- func (handler *Handler) PullBaseImage(ctx context.Context, baseImage string) error
- func (handler *Handler) StartContainer(ctx context.Context, c config.JobConfiguration) (*container.ContainerCreateCreatedBody, error)
- func (handler *Handler) ValidateDependency() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInterface ¶ added in v0.2.0
type ClientInterface interface { ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error }
ClientInterface describes the interface used to handle docker commands
type FakeClient ¶ added in v0.2.0
type FakeClient struct { ContainerListSuccess bool ImageListSuccess bool ImagePullSuccess bool ContainerCreateSuccess bool ContainerStartSuccess bool ContainerInspectSuccess bool CopyToContainerSuccess bool ContainerStatPathSuccess bool CopyFromContainerSuccess bool ContainerExecCreateSuccess bool ContainerExecAttachSuccess bool ContainerExecInspectSuccess bool ContainerStopSuccess bool ContainerRemoveSuccess bool }
FakeClient Docker mock
func (*FakeClient) ContainerCreate ¶ added in v0.2.0
func (fc *FakeClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
ContainerCreate mock function
func (*FakeClient) ContainerExecAttach ¶ added in v0.2.0
func (fc *FakeClient) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error)
ContainerExecAttach mock function
func (*FakeClient) ContainerExecCreate ¶ added in v0.2.0
func (fc *FakeClient) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
ContainerExecCreate mock function
func (*FakeClient) ContainerExecInspect ¶ added in v0.2.0
func (fc *FakeClient) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
ContainerExecInspect mock function
func (*FakeClient) ContainerInspect ¶ added in v0.2.0
func (fc *FakeClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerInspect mock function
func (*FakeClient) ContainerList ¶ added in v0.2.0
func (fc *FakeClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
ContainerList mock function
func (*FakeClient) ContainerRemove ¶ added in v0.2.0
func (fc *FakeClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
ContainerRemove mock function
func (*FakeClient) ContainerStart ¶ added in v0.2.0
func (fc *FakeClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
ContainerStart mock function
func (*FakeClient) ContainerStatPath ¶ added in v0.2.0
func (fc *FakeClient) ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error)
ContainerStatPath mock function
func (*FakeClient) ContainerStop ¶ added in v0.2.0
func (fc *FakeClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ContainerStop mock function
func (*FakeClient) CopyFromContainer ¶ added in v0.2.0
func (fc *FakeClient) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
CopyFromContainer mock function
func (*FakeClient) CopyToContainer ¶ added in v0.2.0
func (fc *FakeClient) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options types.CopyToContainerOptions) error
CopyToContainer mock function
func (*FakeClient) ImageList ¶ added in v0.2.0
func (fc *FakeClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
ImageList mock function
func (*FakeClient) ImagePull ¶ added in v0.2.0
func (fc *FakeClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
ImagePull mock function
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler represents the client to handle Docker tasks
func CreateMock ¶ added in v0.2.0
func CreateMock(client ClientInterface) *Handler
CreateMock generates a mocked docker client
func (*Handler) ContainerRemove ¶
ContainerRemove removes testrunner container
func (*Handler) ContainerStop ¶
ContainerStop stops a running container
func (*Handler) CopyFromContainer ¶
func (handler *Handler) CopyFromContainer(ctx context.Context, srcContainerID string, srcPath string, dstPath string) error
CopyFromContainer downloads a file from the testrunner container
func (*Handler) CopyTestFilesToContainer ¶
func (handler *Handler) CopyTestFilesToContainer(ctx context.Context, srcContainerID string, files []string, targetDir string) error
CopyTestFilesToContainer copies files from the config into the container
func (*Handler) Execute ¶ added in v0.3.7
func (handler *Handler) Execute(ctx context.Context, srcContainerID string, cmd []string) (*types.IDResponse, *types.HijackedResponse, error)
Execute runs the test in the Docker container and attaches to its stdout
func (*Handler) ExecuteInspect ¶
ExecuteInspect checks exit code of test
func (*Handler) HasBaseImage ¶
HasBaseImage checks if base image is installed
func (*Handler) PullBaseImage ¶
PullBaseImage pulls an image from Docker
func (*Handler) StartContainer ¶
func (handler *Handler) StartContainer(ctx context.Context, c config.JobConfiguration) (*container.ContainerCreateCreatedBody, error)
StartContainer starts the Docker testrunner container
func (*Handler) ValidateDependency ¶
ValidateDependency checks if external dependencies are installed