util

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	ExpectedMinT int64
	ExpectedMaxT int64
}

type LabelValuesCall

type LabelValuesCall struct {
	Label        string
	Matchers     []*labels.Matcher
	ReturnValues []string
}

type MockQueryable

type MockQueryable struct {
	TB testing.TB

	// List of expected calls to the Queryable's .Querier() method,
	// order is not enforced to allow for multi-threaded use.
	ExpectedQuerierCalls []Call

	// List of expected calls to the Querier's .Select() method,
	// order is not enforced to allow for multi-threaded use.
	ExpectedSelectCalls []SelectCall

	// List of expected calls to the Querier's .LabelValues() method,
	// order is not enforced to allow for multi-threaded use.
	ExpectedLabelValuesCalls []LabelValuesCall

	UnlimitedCalls bool
	// contains filtered or unexported fields
}

MockQueryable can be used as a querier or queryable in test cases, it is only intended for unit tests and not for any production use. It takes a series of expected querier calls and select calls on the querier, it validates whether all the expected calls have been received and none more. For each expected call the return value can also be defined.

func (*MockQueryable) Close

func (m *MockQueryable) Close() error

func (*MockQueryable) LabelNames

func (m *MockQueryable) LabelNames(_ ...*labels.Matcher) ([]string, storage.Warnings, error)

func (*MockQueryable) LabelValues

func (m *MockQueryable) LabelValues(labelName string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error)

func (*MockQueryable) Querier

func (m *MockQueryable) Querier(_ context.Context, mint, maxt int64) (storage.Querier, error)

func (*MockQueryable) Select

func (m *MockQueryable) Select(sortSeries bool,
	hints *storage.SelectHints,
	matchers ...*labels.Matcher) storage.SeriesSet

func (*MockQueryable) ValidateAllCalls

func (m *MockQueryable) ValidateAllCalls()

ValidateAllCalls checks if all the expected calls have been made, if not it raises a fatal error.

type SelectCall

type SelectCall struct {
	ArgSortSeries bool
	ArgHints      *storage.SelectHints
	ArgMatchers   []*labels.Matcher
	ReturnValue   func() storage.SeriesSet
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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