docker

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package docker contains resources needed to setup docker containers for M3 tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachToExistingContainers

func AttachToExistingContainers(
	coordinatorContainerName string,
	dbNodesContainersNames []string,
) (resources.M3Resources, error)

AttachToExistingContainers attaches docker API to an existing coordinator and one or more dbnode containers.

func NewPrometheus added in v1.3.0

func NewPrometheus(opts PrometheusOptions) resources.ExternalResources

NewPrometheus creates a new docker-backed Prometheus that implements the resources.ExternalResources interface.

func SetupNetwork added in v1.4.0

func SetupNetwork(pool *dockertest.Pool) error

SetupNetwork sets up a network within docker.

func SetupSingleM3DBNode

func SetupSingleM3DBNode(opts ...SetupOptions) (resources.M3Resources, error)

SetupSingleM3DBNode creates docker resources representing a setup with a single DB node.

Types

type Image added in v1.4.0

type Image struct {
	Name string
	Tag  string
}

Image represents a docker image.

type Prometheus added in v1.4.2

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

Prometheus is a docker-backed instantiation of Prometheus.

func (*Prometheus) Close added in v1.4.2

func (p *Prometheus) Close() error

Close cleans up the prometheus instance.

func (*Prometheus) Query added in v1.4.2

Query executes a query request against the prometheus resource.

func (*Prometheus) Setup added in v1.4.2

func (p *Prometheus) Setup() error

Setup is a method that setups up the prometheus instance.

type PrometheusOptions added in v1.3.0

type PrometheusOptions struct {
	// Pool is the connection to the docker API
	Pool *dockertest.Pool
	// PathToCfg contains the path to the prometheus.yml configuration
	// file to be used on startup.
	PathToCfg string
	// InstrumentOptions are the instrument.Options to use when
	// creating the resource.
	InstrumentOptions instrument.Options
}

PrometheusOptions contains the options for spinning up docker container running Prometheus

type PrometheusQueryRequest added in v1.4.2

type PrometheusQueryRequest struct {
	// Query is the prometheus query to execute
	Query string
	// Time is the time to execute the query at
	Time time.Time
}

PrometheusQueryRequest contains the parameters for making a query request.

func (*PrometheusQueryRequest) String added in v1.4.2

func (p *PrometheusQueryRequest) String() string

String converts the query request into a string suitable for use in the url params or request body

type Resource added in v1.4.0

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

Resource is an object that provides a handle to a service being spun up via docker.

func NewDockerResource added in v1.4.0

func NewDockerResource(
	pool *dockertest.Pool,
	resourceOpts ResourceOptions,
) (*Resource, error)

NewDockerResource creates a new DockerResource.

func (*Resource) Close added in v1.4.0

func (c *Resource) Close() error

Close closes and cleans up the resource.

func (*Resource) Closed added in v1.4.0

func (c *Resource) Closed() bool

Closed returns true if the resource has been closed.

func (*Resource) Exec added in v1.4.0

func (c *Resource) Exec(commands ...string) (string, error)

Exec runs commands within a docker container.

func (*Resource) GetPort added in v1.4.0

func (c *Resource) GetPort(bindPort int) (int, error)

GetPort retrieves the port for accessing this resource.

func (*Resource) GetURL added in v1.4.0

func (c *Resource) GetURL(port int, path string) string

GetURL retrieves the URL for accessing this resource.

func (*Resource) GoalStateExec added in v1.4.0

func (c *Resource) GoalStateExec(
	verifier resources.GoalStateVerifier,
	commands ...string,
) error

GoalStateExec runs commands within a container until a specified goal state is met.

type ResourceOptions added in v1.4.0

type ResourceOptions struct {
	OverrideDefaults bool
	Source           string
	ContainerName    string
	Image            Image
	PortList         []int
	// Mounts creates mounts in the container that map back to a resource
	// on the host system.
	Mounts []string
	// TmpfsMounts creates mounts to the container's temporary file system
	TmpfsMounts    []string
	InstrumentOpts instrument.Options
}

ResourceOptions returns options for creating a Resource.

type SetupOptions

type SetupOptions func(*setupOptions)

SetupOptions is a setup option.

func WithCoordinatorImage

func WithCoordinatorImage(name, tag string) SetupOptions

WithCoordinatorImage sets an option to use an image name and tag for the coordinator.

func WithDBNodeImage

func WithDBNodeImage(name, tag string) SetupOptions

WithDBNodeImage sets an option to use an image name and tag for the DB node.

func WithExistingCluster

func WithExistingCluster(dbNodeContainerName, coordinatorContainerName string) SetupOptions

WithExistingCluster sets the names of already running containers dbnode and coordinator containers that should be used for tests.

Jump to

Keyboard shortcuts

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