storetestutil

package
v0.26.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// LabelLongSuffix is a label with ~50B in size, to emulate real-world high cardinality.
	LabelLongSuffix = "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd"
)

Variables

This section is empty.

Functions

func CreateHeadWithSeries

func CreateHeadWithSeries(t testing.TB, j int, opts HeadGenOptions) (*tsdb.Head, []*storepb.Series)

CreateHeadWithSeries returns head filled with given samples and same series returned in separate list for assertion purposes. Returned series list has "ext1"="1" prepended. Each series looks as follows: {foo=bar,i=000001aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd} <random value> where number indicate sample number from 0. Returned series are framed in the same way as remote read would frame them.

func RunSeriesInterestingCases

func RunSeriesInterestingCases(t testutil.TB, maxSamples, maxSeries int, f func(t testutil.TB, samplesPerSeries, series int))

func TestServerSeries

func TestServerSeries(t testutil.TB, store storepb.StoreServer, cases ...*SeriesCase)

TestServerSeries runs tests against given cases.

Types

type HeadGenOptions

type HeadGenOptions struct {
	TSDBDir                  string
	SamplesPerSeries, Series int
	ScrapeInterval           time.Duration

	WithWAL       bool
	PrependLabels labels.Labels
	SkipChunks    bool // Skips chunks in returned slice (not in generated head!).

	Random *rand.Rand
}

type SeriesCase

type SeriesCase struct {
	Name string
	Req  *storepb.SeriesRequest

	// Exact expectations are checked only for tests. For benchmarks only length is assured.
	ExpectedSeries   []*storepb.Series
	ExpectedWarnings []string
	ExpectedHints    []hintspb.SeriesResponseHints
}

SeriesCase represents single test/benchmark case for testing storepb series.

type SeriesServer

type SeriesServer struct {
	// This field just exist to pseudo-implement the unused methods of the interface.
	storepb.Store_SeriesServer

	SeriesSet []*storepb.Series
	Warnings  []string
	HintsSet  []*types.Any

	Size int64
	// contains filtered or unexported fields
}

SeriesServer is test gRPC storeAPI series server.

func NewSeriesServer

func NewSeriesServer(ctx context.Context) *SeriesServer

func (*SeriesServer) Context

func (s *SeriesServer) Context() context.Context

func (*SeriesServer) Send

Jump to

Keyboard shortcuts

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