integration

package
v0.0.0-...-453cd44 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootDirectory is the directory that is exposed in the per instance
	// directory which can be used by that instance safely.
	RootDirectory = "root"

	// PrefixDirectory is the directory that is exposed in the per instance
	// directory which is used for the mgmt prefix.
	PrefixDirectory = "prefix"

	// ConvergedStatusFile is the name of the file which is used for the
	// converged status tracking.
	ConvergedStatusFile = "csf.txt"

	// StdoutStderrFile is the name of the file which is used for the
	// command output.
	StdoutStderrFile = "stdoutstderr.txt"
)

Variables

This section is empty.

Functions

func BinaryPath

func BinaryPath() (string, error)

BinaryPath returns the full path to an mgmt binary. It expects that someone will run `make build` or something equivalent to produce a binary before this function runs.

func ParsePort

func ParsePort(input string) (int, error)

ParsePort parses a URL and returns the port that was found.

Types

type Cluster

type Cluster struct {
	// Etcd specifies if we should run a standalone etcd instance instead of
	// using the automatic, built-in etcd clustering.
	Etcd bool

	// Hostnames is the list of unique identifiers for this cluster.
	Hostnames []string

	// Preserve prevents the runtime output from being explicitly deleted.
	// This is helpful for running analysis or tests on the output.
	Preserve bool

	// Logf is a logger which should be used.
	Logf func(format string, v ...interface{})

	// Debug enables more verbosity.
	Debug bool
	// contains filtered or unexported fields
}

Cluster represents an mgmt cluster. It uses the instance building blocks to run clustered tests.

func (*Cluster) Close

func (obj *Cluster) Close() error

Close cleans up after we're done with this Cluster.

func (*Cluster) DeployLang

func (obj *Cluster) DeployLang(code string) error

DeployLang deploys some code to the cluster. It arbitrarily picks the first host to run the deploy on unless there is an etcd server running.

func (*Cluster) Dir

func (obj *Cluster) Dir() string

Dir returns the dir where the instance can write to. You should only use this after Init has been called, or it won't have been created and determined yet.

func (*Cluster) Init

func (obj *Cluster) Init() error

Init runs some initialization for this Cluster. It errors if the struct was populated in an invalid way, or if it can't initialize correctly.

func (*Cluster) Instances

func (obj *Cluster) Instances() map[string]*Instance

Instances returns the map of instances attached to this cluster. It is most useful after a cluster has started. Before Init, it won't have any entries.

func (*Cluster) Kill

func (obj *Cluster) Kill() error

Kill the cluster immediately. This is a `kill -9` for if things get stuck.

func (*Cluster) Quit

func (obj *Cluster) Quit(ctx context.Context) error

Quit sends a friendly shutdown request to the cluster. You can specify a context if you'd like to exit earlier. If you trigger an early exit with the context, then this will end up running a `kill -9` so it can return. Remember to leave a longer timeout when using a context since this will have to call quit on each member individually.

func (*Cluster) RunLinear

func (obj *Cluster) RunLinear() error

RunLinear starts up each instance linearly, one at a time.

func (*Cluster) SimpleDeployLang

func (obj *Cluster) SimpleDeployLang(code string) error

SimpleDeployLang is a helper method that takes a struct representing a cluster and runs a sequence of methods on it. This particular helper starts up a series of instances linearly, deploys some code, and then shuts down. Both after initially starting up, after peering each instance, and after deploy, it waits for the instance to converge before running the next step.

func (*Cluster) Wait

func (obj *Cluster) Wait(ctx context.Context) error

Wait until the first converged state is hit for each member in the cluster. Remember to leave a longer timeout when using a context since this will have to call wait on each member individually.

type Instance

type Instance struct {
	// Etcd specifies that this is a pure etcd instance instead of an mgmt
	// one.
	Etcd bool

	// EtcdServer specifies we're connecting to an etcd instance instead of
	// a normal mgmt peer.
	EtcdServer bool

	// Hostname is a unique identifier for this instance.
	Hostname string

	// Preserve prevents the runtime output from being explicitly deleted.
	// This is helpful for running analysis or tests on the output.
	Preserve bool

	// Logf is a logger which should be used.
	Logf func(format string, v ...interface{})

	// Debug enables more verbosity.
	Debug bool
	// contains filtered or unexported fields
}

Instance represents a single running mgmt instance. It is a building block that can be used to run standalone tests, or combined to run clustered tests. It can also be used to run a standalone etcd server instance.

func (*Instance) Close

func (obj *Instance) Close() error

Close cleans up after we're done with this instance.

func (*Instance) CombinedOutput

func (obj *Instance) CombinedOutput() (string, error)

CombinedOutput returns the logged output from the instance.

func (*Instance) DeployLang

func (obj *Instance) DeployLang(code string) error

DeployLang deploys some code to the cluster.

func (*Instance) Dir

func (obj *Instance) Dir() string

Dir returns the dir where the instance can write to. You should only use this after Init has been called, or it won't have been created and determined yet.

func (*Instance) Init

func (obj *Instance) Init() error

Init runs some initialization for this instance. It errors if the struct was populated in an invalid way, or if it can't initialize correctly.

func (*Instance) Kill

func (obj *Instance) Kill() error

Kill the process immediately. This is a `kill -9` for if things get stuck.

func (*Instance) Quit

func (obj *Instance) Quit(ctx context.Context) error

Quit sends a friendly shutdown request to the process. You can specify a context if you'd like to exit earlier. If you trigger an early exit with the context, then this will end up running a `kill -9` so it can return.

func (*Instance) Run

func (obj *Instance) Run(seeds []*Instance) error

Run launches the instance. It returns an error if it was unable to launch.

func (*Instance) SimpleDeployLang

func (obj *Instance) SimpleDeployLang(code string) error

SimpleDeployLang is a helper method that takes a struct and runs a sequence of methods on it. This particular helper starts up an instance, deploys some code, and then shuts down. Both after initially starting up, and after deploy, it waits for the instance to converge before running the next step.

func (*Instance) Wait

func (obj *Instance) Wait(ctx context.Context) error

Wait until the first converged state we hit. It is not necessary to use the `--converged-timeout` option with mgmt for this to work. It tracks this via the `--converged-status-file` option which can be used to track the varying convergence status.

Jump to

Keyboard shortcuts

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