tests

package
v1.125.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRemoteReadSeries

func GenerateRemoteReadSeries(start, end, numOfSeries, numOfSamples int64) []*prompb.TimeSeries

GenerateRemoteReadSeries generates a set of remote read series with the given parameters.

Types

type PrometheusMockStorage

type PrometheusMockStorage struct {
	// contains filtered or unexported fields
}

PrometheusMockStorage is a mock implementation of the Prometheus remote read storage interface.

func NewPrometheusMockStorage

func NewPrometheusMockStorage(series []*prompb.TimeSeries) *PrometheusMockStorage

NewPrometheusMockStorage creates a new PrometheusMockStorage with the provided series.

func (*PrometheusMockStorage) Read

func (ms *PrometheusMockStorage) Read(_ context.Context, query *prompb.Query, sortSeries bool) (storage.SeriesSet, error)

Read implements the storage.Storage interface for reading time series data.

func (*PrometheusMockStorage) Reset

func (ms *PrometheusMockStorage) Reset()

Reset resets the PrometheusMockStorage, clearing any stored query and series.

type RemoteReadServer

type RemoteReadServer struct {
	// contains filtered or unexported fields
}

RemoteReadServer is a mock server that implements the Prometheus remote read protocol.

func NewRemoteReadServer

func NewRemoteReadServer(t *testing.T, series []*prompb.TimeSeries) *RemoteReadServer

NewRemoteReadServer creates a remote read server. It exposes a single endpoint and responds with the passed series based on the request to the read endpoint. It returns a server which should be closed after being used.

func NewRemoteReadStreamServer

func NewRemoteReadStreamServer(t *testing.T, series []*prompb.TimeSeries) *RemoteReadServer

NewRemoteReadStreamServer creates a remote read server that supports streaming responses. passed series based on the request to the read endpoint. It returns a server which should be closed after being used.

func (*RemoteReadServer) Close

func (rrs *RemoteReadServer) Close()

Close closes the server.

func (*RemoteReadServer) HTTPAddr

func (rrs *RemoteReadServer) HTTPAddr() string

HTTPAddr returns the HTTP address of the server.

Jump to

Keyboard shortcuts

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