e2e

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DockerExecutableName is the OS dependent Docker CLI binary name
	DockerExecutableName = "docker"
)

Functions

func CopyFile

func CopyFile(sourceFile string, destinationFile string) error

CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755

func GoldenFile

func GoldenFile(name string) string

GoldenFile golden file specific to platform

func HTTPGetWithRetry

func HTTPGetWithRetry(t *testing.T, 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 expeted one, it retries the same request, returning the response body as a string (empty if we could not reach it)

func Lines

func Lines(output string) []string

Lines split output into lines

func SetupExistingCLI

func SetupExistingCLI() (string, func(), error)

SetupExistingCLI copies the existing CLI in a temporary directory so that the new CLI can be configured to use it

func StdoutContains

func StdoutContains(expected string) func(*icmd.Result) bool

StdoutContains returns a predicate on command result expecting a string in stdout

Types

type E2eCLI

type E2eCLI struct {
	BinDir    string
	ConfigDir string
	// contains filtered or unexported fields
}

E2eCLI is used to wrap the CLI for end to end testing nolint stutter

func NewE2eCLI

func NewE2eCLI(t *testing.T, binDir string) *E2eCLI

NewE2eCLI returns a configured TestE2eCLI

func NewParallelE2eCLI

func NewParallelE2eCLI(t *testing.T, binDir string) *E2eCLI

NewParallelE2eCLI returns a configured TestE2eCLI with t.Parallel() set

func (*E2eCLI) MetricsSocket

func (c *E2eCLI) MetricsSocket() string

MetricsSocket get the path where test metrics will be sent

func (*E2eCLI) NewCmd

func (c *E2eCLI) NewCmd(command string, args ...string) icmd.Cmd

NewCmd creates a cmd object configured with the test environment set

func (*E2eCLI) NewDockerCmd

func (c *E2eCLI) NewDockerCmd(args ...string) icmd.Cmd

NewDockerCmd creates a docker cmd without running it

func (*E2eCLI) PathEnvVar

func (c *E2eCLI) PathEnvVar() string

PathEnvVar returns path (os sensitive) for running test

func (*E2eCLI) RunCmd

func (c *E2eCLI) RunCmd(args ...string) *icmd.Result

RunCmd runs a command, expects no error and returns a result

func (*E2eCLI) RunDockerCmd

func (c *E2eCLI) RunDockerCmd(args ...string) *icmd.Result

RunDockerCmd runs a docker command, expects no error and returns a result

func (*E2eCLI) RunDockerOrExitError

func (c *E2eCLI) RunDockerOrExitError(args ...string) *icmd.Result

RunDockerOrExitError runs a docker command and returns a result

func (*E2eCLI) WaitForCmdResult

func (c *E2eCLI) WaitForCmdResult(command icmd.Cmd, predicate func(*icmd.Result) bool, timeout time.Duration, delay time.Duration)

WaitForCmdResult try to execute a cmd until resulting output matches given predicate

func (*E2eCLI) WaitForCondition added in v1.0.14

func (c *E2eCLI) WaitForCondition(predicate func() (bool, string), timeout time.Duration, delay time.Duration)

WaitForCondition wait for predicate to execute to true

type MockMetricsServer added in v1.0.13

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

MockMetricsServer a mock registring all metrics POST invocations

func NewMetricsServer added in v1.0.13

func NewMetricsServer(socket string) *MockMetricsServer

NewMetricsServer instaniate a new MockMetricsServer

func (*MockMetricsServer) GetUsage added in v1.0.13

func (s *MockMetricsServer) GetUsage() []string

GetUsage get usage

func (*MockMetricsServer) ResetUsage added in v1.0.13

func (s *MockMetricsServer) ResetUsage()

ResetUsage reset usage

func (*MockMetricsServer) Start added in v1.0.13

func (s *MockMetricsServer) Start()

Start start the mock server

func (*MockMetricsServer) Stop added in v1.0.13

func (s *MockMetricsServer) Stop()

Stop stop the mock server

Jump to

Keyboard shortcuts

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