runner

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0, MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// magic values that we monitor on the Testground runner side to detect when Testground
	// testplan instances are initialised and at the stage of actually running a test
	// check sdk/sync for more information
	NetworkInitialisationSuccessful = "network initialisation successful"
	NetworkInitialisationFailed     = "network initialisation failed"
)
View Source
const (
	Error eventType = iota
	Start
	Ok
	Fail
	Crash
	Incomplete
	Message
	Metric
	Other
	InternalErr
)
View Source
const InfraMaxFilesUlimit int64 = 1048576

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterK8sRunner

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

ClusterK8sRunner is a runner that creates a Docker service to launch as many replicated instances of a container as the run job indicates.

func (*ClusterK8sRunner) CollectOutputs

func (c *ClusterK8sRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error

func (*ClusterK8sRunner) CompatibleBuilders

func (*ClusterK8sRunner) CompatibleBuilders() []string

func (*ClusterK8sRunner) ConfigType

func (*ClusterK8sRunner) ConfigType() reflect.Type

func (*ClusterK8sRunner) Healthcheck added in v0.3.0

func (c *ClusterK8sRunner) Healthcheck(_ context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)

func (*ClusterK8sRunner) ID

func (*ClusterK8sRunner) ID() string

func (*ClusterK8sRunner) Run

func (*ClusterK8sRunner) TerminateAll added in v0.2.0

func (c *ClusterK8sRunner) TerminateAll(_ context.Context, ow *rpc.OutputWriter) error

Terminates all pods for with the label testground.purpose: plan This command will remove all plan pods in the cluster.

type ClusterK8sRunnerConfig

type ClusterK8sRunnerConfig struct {
	// LogLevel sets the log level in the test containers (default: not set).
	LogLevel string `toml:"log_level"`

	KeepService bool `toml:"keep_service"`

	// Resources requested for each pod from the Kubernetes cluster
	PodResourceMemory string `toml:"pod_resource_memory"`
	PodResourceCPU    string `toml:"pod_resource_cpu"`
}

ClusterK8sRunnerConfig is the configuration object of this runner. Boolean values are expressed in a way that zero value (false) is the default setting.

type ClusterSwarmRunner

type ClusterSwarmRunner struct{}

ClusterSwarmRunner is a runner that creates a Docker service to launch as many replicated instances of a container as the run job indicates.

func (*ClusterSwarmRunner) CollectOutputs

func (*ClusterSwarmRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error

func (*ClusterSwarmRunner) CompatibleBuilders

func (*ClusterSwarmRunner) CompatibleBuilders() []string

func (*ClusterSwarmRunner) ConfigType

func (*ClusterSwarmRunner) ConfigType() reflect.Type

func (*ClusterSwarmRunner) ID

func (*ClusterSwarmRunner) ID() string

func (*ClusterSwarmRunner) Run

TODO runner option to keep containers alive instead of deleting them after the test has run.

type ClusterSwarmRunnerConfig

type ClusterSwarmRunnerConfig struct {
	// LogLevel sets the log level in the test containers (default: not set).
	LogLevel string `toml:"log_level"`

	// Background avoids tailing the output of containers, and displaying it as
	// log messages (default: true).
	Background bool `toml:"background"`

	// DockerEndpoint is the URL of the docker swarm manager endpoint, e.g.
	// "tcp://manager:2376"
	DockerEndpoint string `toml:"docker_endpoint"`

	// DockerTLS indicates whether client TLS is enabled.
	DockerTLS bool `toml:"docker_tls"`

	// DockerTLSCACertPath is the path to the CA Certificate. Only used if
	// DockerTLS = true.
	DockerTLSCACertPath string `toml:"docker_tls_ca_cert_path"`

	// DockerTLSCertPath is the path to our client cert, signed by the CA. Only
	// used if DockerTLS = true.
	DockerTLSCertPath string `toml:"docker_tls_cert_path"`

	// DockerTLSKeyPath is our private key. Only used if DockerTLS = true.
	DockerTLSKeyPath string `toml:"docker_tls_key_path"`

	// KeepService keeps the service after all instances have finished and
	// all logs have been piped. Only used when running in foreground mode
	// (default is background mode).
	KeepService bool `toml:"keep_service"`
}

ClusterSwarmRunnerConfig is the configuration object of this runner. Boolean values are expressed in a way that zero value (false) is the default setting.

type FakeWriterAt

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

func (FakeWriterAt) WriteAt

func (fw FakeWriterAt) WriteAt(p []byte, offset int64) (n int, err error)

type KubernetesConfig

type KubernetesConfig struct {
	// KubeConfigPath is the path to your kubernetes configuration path
	KubeConfigPath string `json:"kubeConfigPath"`
	// Namespace is the kubernetes namespaces where the pods should be running
	Namespace string `json:"namespace"`
}

type LocalDockerRunner

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

LocalDockerRunner is a runner that manually stands up as many docker containers as instances the run job indicates.

It creates a user-defined bridge, to which it attaches a redis service, and all the containers that belong to this test case. It then monitors all test containers, and destroys the setup once all workloads are done.

What we do here is slightly similar to what Docker Compose does, but we can't use the latter because it's a python program and it doesn't expose a network API.

func (*LocalDockerRunner) CollectOutputs

func (*LocalDockerRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error

func (*LocalDockerRunner) CompatibleBuilders

func (*LocalDockerRunner) CompatibleBuilders() []string

func (*LocalDockerRunner) ConfigType

func (*LocalDockerRunner) ConfigType() reflect.Type

func (*LocalDockerRunner) Healthcheck added in v0.2.0

func (r *LocalDockerRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)

func (*LocalDockerRunner) ID

func (*LocalDockerRunner) ID() string

func (*LocalDockerRunner) Run

func (*LocalDockerRunner) TerminateAll added in v0.2.0

func (*LocalDockerRunner) TerminateAll(ctx context.Context, ow *rpc.OutputWriter) error

This method deletes the testground containers. It does *not* delete any downloaded images or networks. I'll leave a friendly message for how to do a more complete cleanup.

type LocalDockerRunnerConfig

type LocalDockerRunnerConfig struct {
	// KeepContainers retains test containers even after they exit (default:
	// false).
	KeepContainers bool `toml:"keep_containers"`
	// LogLevel sets the log level in the test containers (default: not set).
	LogLevel string `toml:"log_level"`
	// Unstarted creates the containers without starting them (default: false).
	Unstarted bool `toml:"no_start"`
	// Background avoids tailing the output of containers, and displaying it as
	// log messages (default: false).
	Background bool `toml:"background"`
	// Ulimits that should be applied on this run, in Docker format.
	// See
	// https://docs.docker.com/engine/reference/commandline/run/#set-ulimits-in-container---ulimit
	// (default: ["nofile=1048576:1048576"]).
	Ulimits []string `toml:"ulimits"`
}

LocalDockerRunnerConfig is the configuration object of this runner. Boolean values are expressed in a way that zero value (false) is the default setting.

type LocalExecutableRunner

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

func (*LocalExecutableRunner) Close added in v0.2.0

func (r *LocalExecutableRunner) Close() error

func (*LocalExecutableRunner) CollectOutputs

func (*LocalExecutableRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error

func (*LocalExecutableRunner) CompatibleBuilders

func (*LocalExecutableRunner) CompatibleBuilders() []string

func (*LocalExecutableRunner) ConfigType

func (*LocalExecutableRunner) ConfigType() reflect.Type

func (*LocalExecutableRunner) Healthcheck added in v0.2.0

func (r *LocalExecutableRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)

func (*LocalExecutableRunner) ID

func (*LocalExecutableRunner) Run

func (*LocalExecutableRunner) TerminateAll added in v0.4.0

func (*LocalExecutableRunner) TerminateAll(ctx context.Context, ow *rpc.OutputWriter) error

type LocalExecutableRunnerCfg

type LocalExecutableRunnerCfg struct{}

LocalExecutableRunnerCfg is the configuration struct for this runner.

type PrettyPrinter

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

PrettyPrinter is a logger that sends output to the console.

func NewPrettyPrinter

func NewPrettyPrinter(ow *rpc.OutputWriter) *PrettyPrinter

NewPrettyPrinter constructs a new console logger.

func (*PrettyPrinter) FailStart

func (c *PrettyPrinter) FailStart(id string, message interface{})

FailStart should be used to report that an instance failed to start.

func (*PrettyPrinter) Manage

func (c *PrettyPrinter) Manage(id string, stdout, stderr io.ReadCloser)

Manage should be called on the standard output of all instances. It will send the events to a logger and record whether or not the test passed.

func (*PrettyPrinter) Wait

func (c *PrettyPrinter) Wait() <-chan error

Wait waits for all running tests to finish and returns an error if any of them failed.

Jump to

Keyboard shortcuts

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