legacydocker

package
v0.31.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProjectPath = "/home/seluser"

DefaultProjectPath represents the default project path. Test files will be located here.

View Source
const RegistryPasswordEnvKey = "REGISTRY_PASSWORD"

RegistryPasswordEnvKey represents the password environment variable for authenticating against a docker registry.

View Source
const RegistryUsernameEnvKey = "REGISTRY_USERNAME"

RegistryUsernameEnvKey represents the username environment variable for authenticating against a docker registry.

Variables

This section is empty.

Functions

func NewImagePullOptions

func NewImagePullOptions() (types.ImagePullOptions, error)

NewImagePullOptions returns a new types.ImagePullOptions object. Credentials are also configured, if available via environment variables (see RegistryUsernameEnvKey and RegistryPasswordEnvKey).

Types

type LegacyCommonAPIClient

type LegacyCommonAPIClient 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.ExecStartCheck) (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
}

LegacyCommonAPIClient is the interface for interacting with containers.

Deprecated.

type LegacyHandler

type LegacyHandler struct {
	// contains filtered or unexported fields
}

LegacyHandler represents the client to handle Docker tasks

Deprecated.

func CreateLegacy

func CreateLegacy() (*LegacyHandler, error)

CreateLegacy generates a docker client

func CreateLegacyMock

func CreateLegacyMock(client LegacyCommonAPIClient) *LegacyHandler

CreateLegacyMock allows to get a handler with a custom interface

func (*LegacyHandler) ContainerInspect

func (handler *LegacyHandler) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)

ContainerInspect returns the container information.

func (*LegacyHandler) ContainerRemove

func (handler *LegacyHandler) ContainerRemove(ctx context.Context, srcContainerID string) error

ContainerRemove removes testrunner container

func (*LegacyHandler) ContainerStop

func (handler *LegacyHandler) ContainerStop(ctx context.Context, srcContainerID string) error

ContainerStop stops a running container

func (*LegacyHandler) CopyFilesToContainer

func (handler *LegacyHandler) CopyFilesToContainer(ctx context.Context, srcContainerID string, files []string, targetDir string) error

CopyFilesToContainer copies the given files into the container.

func (*LegacyHandler) CopyFromContainer

func (handler *LegacyHandler) CopyFromContainer(ctx context.Context, srcContainerID string, srcPath string, dstPath string) error

CopyFromContainer downloads a file from the testrunner container

func (*LegacyHandler) CopyToContainer

func (handler *LegacyHandler) CopyToContainer(ctx context.Context, containerID string, srcFile string, targetDir string) error

CopyToContainer copies the given file to the container.

func (*LegacyHandler) Execute

func (handler *LegacyHandler) 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 (*LegacyHandler) ExecuteInspect

func (handler *LegacyHandler) ExecuteInspect(ctx context.Context, srcContainerID string) (int, error)

ExecuteInspect checks exit code of test

func (*LegacyHandler) GetImageFlavor

func (handler *LegacyHandler) GetImageFlavor(c config.Project) string

GetImageFlavor returns a string that contains the image name and tag defined by the project.

func (*LegacyHandler) HasBaseImage

func (handler *LegacyHandler) HasBaseImage(ctx context.Context, baseImage string) (bool, error)

HasBaseImage checks if base image is installed

func (*LegacyHandler) IsErrNotFound

func (handler *LegacyHandler) IsErrNotFound(err error) bool

IsErrNotFound returns true if the error is a NotFound error, which is returned by the API when some object is not found.

func (*LegacyHandler) PullBaseImage

func (handler *LegacyHandler) PullBaseImage(ctx context.Context, c config.Project) error

PullBaseImage pulls an image from Docker

func (*LegacyHandler) StartContainer

StartContainer starts the Docker testrunner container

func (*LegacyHandler) ValidateDependency

func (handler *LegacyHandler) ValidateDependency() error

ValidateDependency checks if external dependencies are installed

type LegacyRunner deprecated

type LegacyRunner struct {
	runner.BaseRunner
	// contains filtered or unexported fields
}

LegacyRunner represents the docker implementation of a test runner. Only meant for use with frameworks that did not yet support native configs.

Deprecated: Use the appropriate, framework specific runner instead.

func NewRunner deprecated

func NewRunner(c config.Project, cli *command.SauceCtlCli, seq fleet.Sequencer) (*LegacyRunner, error)

NewRunner creates a new LegacyRunner instance.

Deprecated: Use the appropriate, framework specific runner instead.

func (*LegacyRunner) RunProject

func (r *LegacyRunner) RunProject() (int, error)

RunProject runs the tests defined in config.Project.

Jump to

Keyboard shortcuts

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