docker

package
v2.0.0-...-e8682ef Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MPL-2.0, MPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNumCores = 1

TODO: allow number of cores/servers to be configurable

Functions

This section is empty.

Types

type DockerCluster

type DockerCluster struct {
	ID string
	// PluginName is the input from the test case
	PluginName string
	// ClusterName is a UUID name of the cluster.
	ClusterName string

	// MountOptions are a set of options for registering and mounting the plugin
	MountOptions stepwise.MountOptions

	RaftStorage  bool
	ClusterNodes []*dockerClusterNode

	// Certificate fields
	CACert        *x509.Certificate
	CACertBytes   []byte
	CACertPEM     []byte
	CACertPEMFile string
	CAKey         *ecdsa.PrivateKey
	CAKeyPEM      []byte
	RootCAs       *x509.CertPool
	// contains filtered or unexported fields
}

DockerCluster is used to managing the lifecycle of the test Vault cluster

func NewEnvironment

func NewEnvironment(name string, options *stepwise.MountOptions) *DockerCluster

NewEnvironment creats a new Stepwise Environment for executing tests

func (*DockerCluster) Client

func (dc *DockerCluster) Client() (*api.Client, error)

Client returns a clone of the configured Vault API client.

func (*DockerCluster) Initialize

func (dc *DockerCluster) Initialize(ctx context.Context) error

func (*DockerCluster) MountPath

func (dc *DockerCluster) MountPath() string

MountPath returns the path that the plugin under test is mounted at. If a MountPathPrefix was given, the mount path uses the prefix with a uuid appended. The default is the given PluginName with a uuid suffix.

func (*DockerCluster) Name

func (dc *DockerCluster) Name() string

Name returns the name of this environment

func (*DockerCluster) RootToken

func (dc *DockerCluster) RootToken() string

RootToken returns the root token of the cluster, if set

func (*DockerCluster) Setup

func (dc *DockerCluster) Setup() error

Setup creates any temp directories needed and compiles the binary for copying to Docker

func (*DockerCluster) Teardown

func (dc *DockerCluster) Teardown() error

Teardown stops all the containers.

type DockerClusterOptions

type DockerClusterOptions struct {
	KeepStandbysSealed bool
	RequireClientAuth  bool
	SkipInit           bool
	CACert             []byte
	NumCores           int

	PluginTestBin string
	// SetupFunc is called after the cluster is started.
	SetupFunc func(t testing.T, c *DockerCluster)
	CAKey     *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

DockerClusterOptions has options for setting up the docker cluster

type Runner

type Runner struct {
	ContainerConfig *container.Config
	ContainerName   string
	NetName         string
	IP              string
	CopyFromTo      map[string]string
	// contains filtered or unexported fields
}

Runner manages the lifecycle of the Docker container

func (*Runner) Start

func (d *Runner) Start(ctx context.Context) (*types.ContainerJSON, error)

Start is responsible for executing the Vault container. It consists of pulling the specified Vault image, creating the container, and copies the plugin binary into the container file system before starting the container itself.

Jump to

Keyboard shortcuts

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