Documentation ¶
Index ¶
- Constants
- Variables
- type ClusterK8sRunner
- func (c *ClusterK8sRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error
- func (*ClusterK8sRunner) CompatibleBuilders() []string
- func (*ClusterK8sRunner) ConfigType() reflect.Type
- func (c *ClusterK8sRunner) Enabled() bool
- func (c *ClusterK8sRunner) GetClusterCapacity() (int64, int64, error)
- func (c *ClusterK8sRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)
- func (*ClusterK8sRunner) ID() string
- func (c *ClusterK8sRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (runoutput *api.RunOutput, runerr error)
- func (c *ClusterK8sRunner) TerminateAll(ctx context.Context, ow *rpc.OutputWriter) error
- type ClusterK8sRunnerConfig
- type ClusterSwarmRunner
- func (*ClusterSwarmRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error
- func (*ClusterSwarmRunner) CompatibleBuilders() []string
- func (*ClusterSwarmRunner) ConfigType() reflect.Type
- func (*ClusterSwarmRunner) ID() string
- func (*ClusterSwarmRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (*api.RunOutput, error)
- type ClusterSwarmRunnerConfig
- type ExposedPorts
- type FakeWriterAt
- type GroupOutcome
- type Journal
- type KubernetesConfig
- type LocalDockerRunner
- func (r *LocalDockerRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error
- func (*LocalDockerRunner) CompatibleBuilders() []string
- func (*LocalDockerRunner) ConfigType() reflect.Type
- func (r *LocalDockerRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)
- func (*LocalDockerRunner) ID() string
- func (r *LocalDockerRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (runoutput *api.RunOutput, err error)
- func (*LocalDockerRunner) TerminateAll(ctx context.Context, ow *rpc.OutputWriter) error
- type LocalDockerRunnerConfig
- type LocalExecutableRunner
- func (r *LocalExecutableRunner) Close() error
- func (r *LocalExecutableRunner) CollectOutputs(ctx context.Context, input *api.CollectionInput, ow *rpc.OutputWriter) error
- func (*LocalExecutableRunner) CompatibleBuilders() []string
- func (*LocalExecutableRunner) ConfigType() reflect.Type
- func (r *LocalExecutableRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)
- func (*LocalExecutableRunner) ID() string
- func (r *LocalExecutableRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (*api.RunOutput, error)
- func (*LocalExecutableRunner) TerminateAll(ctx context.Context, ow *rpc.OutputWriter) error
- type LocalExecutableRunnerCfg
- type PrettyPrinter
- type Result
Constants ¶
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" )
const ( Error eventType = iota Start Ok Fail Crash Incomplete Message Metric Other InternalErr )
const InfraMaxFilesUlimit int64 = 1048576
Variables ¶
var ErrRunnerDisabled = fmt.Errorf("runner is disabled by config")
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) Enabled ¶ added in v0.6.0
func (c *ClusterK8sRunner) Enabled() bool
func (*ClusterK8sRunner) GetClusterCapacity ¶ added in v0.6.0
func (c *ClusterK8sRunner) GetClusterCapacity() (int64, int64, error)
func (*ClusterK8sRunner) Healthcheck ¶
func (c *ClusterK8sRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)
func (*ClusterK8sRunner) ID ¶
func (*ClusterK8sRunner) ID() string
func (*ClusterK8sRunner) Run ¶
func (c *ClusterK8sRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (runoutput *api.RunOutput, runerr error)
func (*ClusterK8sRunner) TerminateAll ¶
func (c *ClusterK8sRunner) TerminateAll(ctx context.Context, ow *rpc.OutputWriter) error
TerminateAll 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"` // Provider is the infrastructure provider to use Provider string `toml:"provider"` // Whether Kubernetes cluster has an autoscaler running AutoscalerEnabled bool `toml:"autoscaler_enabled"` // Resources requested for each testplan pod from the Kubernetes cluster TestplanPodMemory string `toml:"testplan_pod_memory"` TestplanPodCPU string `toml:"testplan_pod_cpu"` // Resources requested for the `collect-outputs` pod from the Kubernetes cluster CollectOutputsPodMemory string `toml:"collect_outputs_pod_memory"` CollectOutputsPodCPU string `toml:"collect_outputs_pod_cpu"` ExposedPorts ExposedPorts `toml:"exposed_ports"` RunTimeoutMin int `toml:"run_timeout_min"` Sysctls []string `toml:"sysctls"` }
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
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 ExposedPorts ¶ added in v0.5.3
ExposedPorts is a simple type that holds port mappings.
func (ExposedPorts) ToEnvVars ¶ added in v0.5.3
func (e ExposedPorts) ToEnvVars() map[string]string
ToEnvVars returns a map that represents these port mappings as environment variables, in the form ${LABEL}_PORT=${PORT_NUMBER}.
The result can be piped through conv.ToOptionsSlice to turn it into a slice.
type FakeWriterAt ¶
type FakeWriterAt struct {
// contains filtered or unexported fields
}
type GroupOutcome ¶ added in v0.6.0
func (*GroupOutcome) String ¶ added in v0.6.0
func (g *GroupOutcome) String() string
type KubernetesConfig ¶
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 (r *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 ¶
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 (r *LocalDockerRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (runoutput *api.RunOutput, err error)
func (*LocalDockerRunner) TerminateAll ¶
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"` ExposedPorts ExposedPorts `toml:"exposed_ports"` // Collection timeout is the time we wait for the sync service to send us the test outcomes after // all instances have finished. OutcomesCollectionTimeout time.Duration `toml:"outcomes_collection_timeout"` AdditionalHosts []string `toml:"additional_hosts"` }
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 ¶
func (r *LocalExecutableRunner) Close() error
func (*LocalExecutableRunner) CollectOutputs ¶
func (r *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 ¶
func (r *LocalExecutableRunner) Healthcheck(ctx context.Context, engine api.Engine, ow *rpc.OutputWriter, fix bool) (*api.HealthcheckReport, error)
func (*LocalExecutableRunner) ID ¶
func (*LocalExecutableRunner) ID() string
func (*LocalExecutableRunner) Run ¶
func (r *LocalExecutableRunner) Run(ctx context.Context, input *api.RunInput, ow *rpc.OutputWriter) (*api.RunOutput, error)
func (*LocalExecutableRunner) TerminateAll ¶
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) Append ¶ added in v0.5.1
func (c *PrettyPrinter) Append(id string, stdout, stderr io.ReadCloser)
Append is the same as Manage, but doesn't wait for instance to exit.
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.
type Result ¶ added in v0.6.0
type Result struct { Outcome task.Outcome `json:"outcome"` Outcomes map[string]*GroupOutcome `json:"outcomes"` Journal *Journal `json:"journal"` }