Documentation ¶
Overview ¶
Package docker contains resources needed to setup docker containers for M3 tests.
Index ¶
- func AttachToExistingContainers(coordinatorContainerName string, dbNodesContainersNames []string) (resources.M3Resources, error)
- func NewPrometheus(opts PrometheusOptions) resources.ExternalResources
- func SetupNetwork(pool *dockertest.Pool) error
- func SetupSingleM3DBNode(opts ...SetupOptions) (resources.M3Resources, error)
- type Image
- type Prometheus
- type PrometheusOptions
- type PrometheusQueryRequest
- type Resource
- func (c *Resource) Close() error
- func (c *Resource) Closed() bool
- func (c *Resource) Exec(commands ...string) (string, error)
- func (c *Resource) GetPort(bindPort int) (int, error)
- func (c *Resource) GetURL(port int, path string) string
- func (c *Resource) GoalStateExec(verifier resources.GoalStateVerifier, commands ...string) error
- type ResourceOptions
- type SetupOptions
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 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
func (p *Prometheus) Query(req PrometheusQueryRequest) (model.Vector, error)
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) 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.