Documentation ¶
Index ¶
- Constants
- Variables
- func NewImagePullOptions() (types.ImagePullOptions, error)
- type CommonAPIClient
- 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) CopyFilesToContainer(ctx context.Context, srcContainerID string, files []string, targetDir string) error
- func (handler *Handler) CopyFromContainer(ctx context.Context, srcContainerID string, srcPath string, dstPath string) error
- func (handler *Handler) CopyToContainer(ctx context.Context, containerID string, srcFile 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) GetImageFlavor(c config.Project) string
- func (handler *Handler) HasBaseImage(ctx context.Context, baseImage string) (bool, error)
- func (handler *Handler) PullBaseImage(ctx context.Context, c config.Project) error
- func (handler *Handler) StartContainer(ctx context.Context, c config.Project, s config.Suite) (*container.ContainerCreateCreatedBody, error)
- func (handler *Handler) ValidateDependency() error
- type Image
- type Runner
Constants ¶
const DefaultProjectPath = "/home/seluser"
DefaultProjectPath represents the default project path. Test files will be located here.
const RegistryPasswordEnvKey = "REGISTRY_PASSWORD"
RegistryPasswordEnvKey represents the password environment variable for authenticating against a docker registry.
const RegistryUsernameEnvKey = "REGISTRY_USERNAME"
RegistryUsernameEnvKey represents the username environment variable for authenticating against a docker registry.
Variables ¶
var DefaultCypress = Image{
Name: "saucelabs/stt-cypress-mocha-node",
Version: "v0.1.9",
TestsFolder: "cypress/integration",
Match: ".*.(spec|test).js$",
}
DefaultCypress represents the default image for cypress.
var DefaultPlaywright = Image{
Name: "saucelabs/stt-playwright-jest-node",
Version: "v0.1.6",
TestsFolder: "tests",
Match: ".*.(spec|test).js$",
}
DefaultPlaywright represents the default image for playwright.
var DefaultPuppeteer = Image{
Name: "saucelabs/stt-puppeteer-jest-node",
Version: "v0.1.5",
TestsFolder: "tests",
Match: ".*.(spec|test).js$",
}
DefaultPuppeteer represents the default image for puppeteer.
var DefaultTestcafe = Image{
Name: "saucelabs/stt-testcafe-node",
Version: "v0.1.5",
TestsFolder: "tests",
Match: ".*.(spec|test).[jt]s$",
}
DefaultTestcafe represents the default image for testcafe.
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 CommonAPIClient ¶
type CommonAPIClient 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 }
CommonAPIClient is the interface for interacting with containers.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler represents the client to handle Docker tasks
func CreateMock ¶
func CreateMock(client CommonAPIClient) *Handler
CreateMock allows to get a handler with a custom interface
func (*Handler) ContainerRemove ¶
ContainerRemove removes testrunner container
func (*Handler) ContainerStop ¶
ContainerStop stops a running container
func (*Handler) CopyFilesToContainer ¶ added in v0.12.0
func (handler *Handler) CopyFilesToContainer(ctx context.Context, srcContainerID string, files []string, targetDir string) error
CopyFilesToContainer copies the given files into the 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) CopyToContainer ¶
func (handler *Handler) CopyToContainer(ctx context.Context, containerID string, srcFile string, targetDir string) error
CopyToContainer copies the given file to the container.
func (*Handler) Execute ¶
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) GetImageFlavor ¶
GetImageFlavor returns a string that contains the image name and tag defined by the project.
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.Project, s config.Suite) (*container.ContainerCreateCreatedBody, error)
StartContainer starts the Docker testrunner container
func (*Handler) ValidateDependency ¶
ValidateDependency checks if external dependencies are installed
type Runner ¶
type Runner struct { runner.BaseRunner // contains filtered or unexported fields }
Runner represents the docker implementation of a test runner.
func (*Runner) RunProject ¶ added in v0.12.1
RunProject runs the tests defined in config.Project.