Documentation ¶
Index ¶
- Variables
- func ComposeStandalonePath(t testing.TB) string
- func CopyFile(t testing.TB, sourceFile string, destinationFile string)
- func HTTPGetWithRetry(t testing.TB, endpoint string, expectedStatus int, retryDelay time.Duration, ...) string
- func IsHealthy(service string) func(res *icmd.Result) bool
- func Lines(output string) []string
- func RequireServiceState(t testing.TB, cli *CLI, service string, state string)
- func StdoutContains(expected string) func(*icmd.Result) bool
- type CLI
- func (c *CLI) BaseEnvironment() []string
- func (c *CLI) MetricsSocket() string
- func (c *CLI) NewCmd(command string, args ...string) icmd.Cmd
- func (c *CLI) NewCmdWithEnv(envvars []string, command string, args ...string) icmd.Cmd
- func (c *CLI) NewDockerCmd(t testing.TB, args ...string) icmd.Cmd
- func (c *CLI) NewDockerComposeCmd(t testing.TB, args ...string) icmd.Cmd
- func (c *CLI) RunCmd(t testing.TB, args ...string) *icmd.Result
- func (c *CLI) RunCmdInDir(t testing.TB, dir string, args ...string) *icmd.Result
- func (c *CLI) RunDockerCmd(t testing.TB, args ...string) *icmd.Result
- func (c *CLI) RunDockerComposeCmd(t testing.TB, args ...string) *icmd.Result
- func (c *CLI) RunDockerComposeCmdNoCheck(t testing.TB, args ...string) *icmd.Result
- func (c *CLI) RunDockerOrExitError(t testing.TB, args ...string) *icmd.Result
- func (c *CLI) WaitForCmdResult(t testing.TB, command icmd.Cmd, predicate func(*icmd.Result) bool, ...)
- func (c *CLI) WaitForCondition(t testing.TB, predicate func() (bool, string), timeout time.Duration, ...)
- type CLIOption
Constants ¶
This section is empty.
Variables ¶
var ( // DockerExecutableName is the OS dependent Docker CLI binary name DockerExecutableName = "docker" // DockerComposeExecutableName is the OS dependent Docker CLI binary name DockerComposeExecutableName = "docker-" + compose.PluginName // DockerScanExecutableName is the OS dependent Docker Scan plugin binary name DockerScanExecutableName = "docker-scan" // DockerBuildxExecutableName is the Os dependent Buildx plugin binary name DockerBuildxExecutableName = "docker-buildx" // WindowsExecutableSuffix is the Windows executable suffix WindowsExecutableSuffix = ".exe" )
Functions ¶
func ComposeStandalonePath ¶ added in v2.6.1
ComposeStandalonePath returns the path to the locally-built Compose standalone binary from the repo.
This function will fail the test immediately if invoked when not running in standalone test mode.
func CopyFile ¶
CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755
func HTTPGetWithRetry ¶
func HTTPGetWithRetry( t testing.TB, endpoint string, expectedStatus int, retryDelay time.Duration, timeout time.Duration, ) string
HTTPGetWithRetry performs an HTTP GET on an `endpoint`, using retryDelay also as a request timeout. In the case of an error or the response status is not the expected one, it retries the same request, returning the response body as a string (empty if we could not reach it)
func RequireServiceState ¶ added in v2.10.0
RequireServiceState ensures that the container is in the expected state (running or exited).
Types ¶
type CLI ¶ added in v2.6.1
type CLI struct { // ConfigDir for Docker configuration (set as DOCKER_CONFIG) ConfigDir string // HomeDir for tools that look for user files (set as HOME) HomeDir string // contains filtered or unexported fields }
CLI is used to wrap the CLI for end to end testing
func NewParallelCLI ¶ added in v2.6.1
NewParallelCLI marks the parent test as parallel and returns a CLI instance suitable for usage across child tests.
func (*CLI) BaseEnvironment ¶ added in v2.6.1
BaseEnvironment provides the minimal environment variables used across all Docker / Compose commands.
func (*CLI) MetricsSocket ¶ added in v2.6.1
MetricsSocket get the path where test metrics will be sent
func (*CLI) NewCmd ¶ added in v2.6.1
NewCmd creates a cmd object configured with the test environment set
func (*CLI) NewCmdWithEnv ¶ added in v2.6.1
NewCmdWithEnv creates a cmd object configured with the test environment set with additional env vars
func (*CLI) NewDockerCmd ¶ added in v2.6.1
NewDockerCmd creates a docker cmd without running it
func (*CLI) NewDockerComposeCmd ¶ added in v2.6.1
NewDockerComposeCmd creates a command object for Compose, either in plugin or standalone mode (based on build tags).
func (*CLI) RunCmdInDir ¶ added in v2.6.1
RunCmdInDir runs a command in a given dir, expects no error and returns a result
func (*CLI) RunDockerCmd ¶ added in v2.6.1
RunDockerCmd runs a docker command, expects no error and returns a result
func (*CLI) RunDockerComposeCmd ¶ added in v2.6.1
RunDockerComposeCmd runs a docker compose command, expects no error and returns a result
func (*CLI) RunDockerComposeCmdNoCheck ¶ added in v2.6.1
RunDockerComposeCmdNoCheck runs a docker compose command, don't presume of any expectation and returns a result
func (*CLI) RunDockerOrExitError ¶ added in v2.6.1
RunDockerOrExitError runs a docker command and returns a result