resources

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (

	// AggName is the name of the aggregated namespace.
	AggName = "aggregated"
	// UnaggName is the name of the unaggregated namespace.
	UnaggName = "default"
	// ColdWriteNsName is the name for cold write namespace.
	ColdWriteNsName = "coldWritesRepairAndNoIndex"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

type Admin interface {
	// GetNamespace gets namespaces.
	GetNamespace() (admin.NamespaceGetResponse, error)
	// WaitForNamespace blocks until the given namespace is enabled.
	// NB: if the name string is empty, this will instead
	// check for a successful response.
	WaitForNamespace(name string) error
	// AddNamespace adds a namespace.
	AddNamespace(admin.NamespaceAddRequest) (admin.NamespaceGetResponse, error)
	// CreateDatabase creates a database.
	CreateDatabase(admin.DatabaseCreateRequest) (admin.DatabaseCreateResponse, error)
	// GetPlacement gets placements.
	GetPlacement() (admin.PlacementGetResponse, error)
	// WaitForInstances blocks until the given instance is available.
	WaitForInstances(ids []string) error
	// Close closes the wrapper and releases any held resources, including
	// deleting docker containers.
	Close() error
}

Admin is a wrapper for admin functions.

type Coordinator

type Coordinator interface {
	Admin

	// WriteCarbon writes a carbon metric datapoint at a given time.
	WriteCarbon(port int, metric string, v float64, t time.Time) error
	// RunQuery runs the given query with a given verification function.
	RunQuery(verifier ResponseVerifier, query string) error
}

Coordinator is a wrapper for a coordinator. It provides a wrapper on HTTP endpoints that expose cluster management APIs as well as read and write endpoints for series data. TODO: consider having this work on underlying structures.

type DockerResources

type DockerResources interface {
	// Cleanup closes and removes all corresponding containers.
	Cleanup() error
	// Nodes returns all node resources.
	Nodes() Nodes
	// Coordinator returns the coordinator resource.
	Coordinator() Coordinator
}

DockerResources represents a set of dockerized test components.

func SetupSingleM3DBNode

func SetupSingleM3DBNode(opts ...SetupOptions) (DockerResources, error)

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

type GoalStateVerifier

type GoalStateVerifier func(string, error) error

GoalStateVerifier verifies that the given results are valid.

type Node

type Node interface {
	// HostDetails returns this node's host details on the given port.
	HostDetails(port int) (*admin.Host, error)
	// Health gives this node's health.
	Health() (*rpc.NodeHealthResult_, error)
	// WaitForBootstrap blocks until the node has bootstrapped.
	WaitForBootstrap() error
	// WritePoint writes a datapoint to the node directly.
	WritePoint(req *rpc.WriteRequest) error
	// Fetch fetches datapoints.
	Fetch(req *rpc.FetchRequest) (*rpc.FetchResult_, error)
	// Exec executes the given commands on the node container, returning
	// stdout and stderr from the container.
	Exec(commands ...string) (string, error)
	// GoalStateExec executes the given commands on the node container, retrying
	// until applying the verifier returns no error or the default timeout.
	GoalStateExec(verifier GoalStateVerifier, commands ...string) error
	// Restart restarts this container.
	Restart() error
	// Close closes the wrapper and releases any held resources, including
	// deleting docker containers.
	Close() error
}

Node is a wrapper for a db node. It provides a wrapper on HTTP endpoints that expose cluster management APIs as well as read and write endpoints for series data. TODO: consider having this work on underlying structures.

type Nodes

type Nodes []Node

Nodes is a slice of nodes.

type ResponseVerifier added in v1.0.1

type ResponseVerifier func(int, map[string][]string, string, error) error

ResponseVerifier is a function that checks if the query response is valid.

type SetupOptions added in v1.0.1

type SetupOptions func(*setupOptions)

SetupOptions is a setup option.

func WithCoordinatorImage added in v1.0.1

func WithCoordinatorImage(name, tag string) SetupOptions

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

func WithDBNodeImage added in v1.0.1

func WithDBNodeImage(name, tag string) SetupOptions

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

Jump to

Keyboard shortcuts

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