docker

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNumCores = 1

Functions

This section is empty.

Types

type Cluster

type Cluster 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
}

Cluster is used for managing the lifecycle of the test Vault cluster

func NewEnvironment

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

NewEnvironment creates a new Stepwise Environment for executing tests

func (*Cluster) Client

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

Client returns a clone of the configured Vault API client.

func (*Cluster) Initialize

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

func (*Cluster) MountPath

func (dc *Cluster) 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 (*Cluster) Name

func (dc *Cluster) Name() string

Name returns the name of this environment

func (*Cluster) RootToken

func (dc *Cluster) RootToken() string

RootToken returns the root token of the cluster, if set

func (*Cluster) Setup

func (dc *Cluster) Setup() error

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

func (*Cluster) Teardown

func (dc *Cluster) Teardown() error

Teardown stops all the containers.

type ClusterOptions

type ClusterOptions 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 *Cluster)
	CAKey     *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

ClusterOptions 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