testsuite

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Root folder of this project
	Root = filepath.Join(filepath.Dir(b), "..", "..")
	// PromDir is the filepath to the prometheus directory
	PromDir = filepath.Join(Root, ".cache", "prometheus")
	// PromBin is the filepath to the Prometheus binary
	PromBin = filepath.Join(PromDir, "prometheus")
	// PromtoolBin is the filepath to the promtool binary
	PromtoolBin = filepath.Join(PromDir, "promtool")
)

Functions

func StartPrometheus

func StartPrometheus(ctx context.Context, port int) (cleanup func() error, err error)

StartPrometheus starts a new prometheus instance on the given port. Cancel the context to stop. The returned cleanup function block until prometheus is stopped. Cleanup has to be called.

Types

type Suite

type Suite struct {
	dbtest.Suite
	// contains filtered or unexported fields
}

Suite holds a dbtest.Suite and a lazily started prometheus server. Each Suite holds its own Prometheus server. Suites can be run in parallel.

func (*Suite) PrometheusAPIClient

func (ts *Suite) PrometheusAPIClient() apiv1.API

PrometheusAPIClient starts a prometheus server and returns a client to it. The started prometheus is shared in a testsuite.

func (*Suite) PrometheusURL

func (ts *Suite) PrometheusURL() string

PrometheusURL starts a prometheus server and returns the api url to it. The started prometheus is shared in a testsuite.

func (*Suite) TearDownSuite

func (ts *Suite) TearDownSuite()

TearDownSuite stops prometheus and drops the temporary database.

Jump to

Keyboard shortcuts

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