testing

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNDEFINED_METRIC float64 = 99999999999
)

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func BuildExpectedLog

func BuildExpectedLog(timestamp time.Time, requestId, method, path, sourceHost, sourcePort, dstHost, dstPort string) string

func BuildRequest

func BuildRequest(method, url, remoteAddr, requestId, forwardedFor string) *http.Request

func Cert

func Cert(filename string) string

func FormatTimeWithDecimalMillis

func FormatTimeWithDecimalMillis(t time.Time) string

func GetFreePort

func GetFreePort() int

func GrpcTLSCredentials

func GrpcTLSCredentials() credentials.TransportCredentials

func MakeTLSReq

func MakeTLSReq(addr, path string) (*http.Response, error)

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewIngressClient

func NewIngressClient(addr string) (client rpc.IngressClient, cleanup func())

func NewMutualTLSConfig

func NewMutualTLSConfig(caPath, certPath, keyPath, cn string) (*tls.Config, error)

func NewServerRequest

func NewServerRequest(method, uri string, body io.Reader) (*http.Request, error)

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func StartGoProcess

func StartGoProcess(importPath string, env []string, args ...string) *gexec.Session

func WaitForHealthCheck

func WaitForHealthCheck(healthAddr string)

func WaitForServer

func WaitForServer(addr string)

Types

type Point

type Point struct {
	Time  int64
	Value float64
}

type Series

type Series struct {
	Labels map[string]string
	Points []Point
}

func ExplodeSeriesSet

func ExplodeSeriesSet(seriesSet storage.SeriesSet) []Series

type SpyDataReader

type SpyDataReader struct {
	ReadStarts []int64
	ReadEnds   []int64

	ReadResults []*rpc.PromQL_Matrix
	ReadErrs    []error

	LabelsResponse      *rpc.PromQL_LabelsQueryResult
	LabelsError         error
	LabelValuesResponse *rpc.PromQL_LabelValuesQueryResult
	LabelValuesError    error
}

func NewSpyDataReader

func NewSpyDataReader() *SpyDataReader

func (*SpyDataReader) Labels

func (*SpyDataReader) Read

func (s *SpyDataReader) Read(ctx context.Context, params *storage.SelectParams, labelMatchers ...*labels.Matcher) (storage.SeriesSet, error)

type SpyMetricStore

type SpyMetricStore struct {
	QueryError error
	// contains filtered or unexported fields
}

func NewSpyMetricStore

func NewSpyMetricStore(tlsConfig *tls.Config) *SpyMetricStore

func (*SpyMetricStore) GetLabelsQueryRequests

func (s *SpyMetricStore) GetLabelsQueryRequests() []*rpc.PromQL_LabelsQueryRequest

func (*SpyMetricStore) GetPoints

func (s *SpyMetricStore) GetPoints() []*rpc.Point

func (*SpyMetricStore) GetQueryRequests

func (s *SpyMetricStore) GetQueryRequests() []*rpc.PromQL_InstantQueryRequest

func (*SpyMetricStore) GetRangeQueryRequests

func (s *SpyMetricStore) GetRangeQueryRequests() []*rpc.PromQL_RangeQueryRequest

func (*SpyMetricStore) GetSeriesQueryRequests

func (s *SpyMetricStore) GetSeriesQueryRequests() []*rpc.PromQL_SeriesQueryRequest

func (*SpyMetricStore) InstantQuery

func (*SpyMetricStore) LabelsQuery

func (*SpyMetricStore) RangeQuery

func (*SpyMetricStore) Send

func (*SpyMetricStore) SeriesQuery

func (*SpyMetricStore) SetValue

func (s *SpyMetricStore) SetValue(value float64)

func (*SpyMetricStore) Start

func (s *SpyMetricStore) Start() string

type SpyMetrics

type SpyMetrics struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSpyMetrics

func NewSpyMetrics() *SpyMetrics

func (*SpyMetrics) Get

func (s *SpyMetrics) Get(name string) float64

func (*SpyMetrics) GetUnit

func (s *SpyMetrics) GetUnit(name string) string

func (*SpyMetrics) Getter

func (s *SpyMetrics) Getter(name string) func() float64

func (*SpyMetrics) NewCounter

func (s *SpyMetrics) NewCounter(name string) func(uint64)

func (*SpyMetrics) NewGauge

func (s *SpyMetrics) NewGauge(name, unit string) func(float64)

func (*SpyMetrics) NewSummary

func (s *SpyMetrics) NewSummary(name, unit string) func(float64)

func (*SpyMetrics) SummaryObservationsGetter

func (s *SpyMetrics) SummaryObservationsGetter(name string) func() []float64

type SpyQueryEngine

type SpyQueryEngine struct {
	InstantQueryDataReader query.DataReader
	RangeQueryDataReader   query.DataReader
	SeriesQueryDataReader  query.DataReader
	RespondWithError       bool
}

func NewSpyQueryEngine

func NewSpyQueryEngine() *SpyQueryEngine

func (*SpyQueryEngine) InstantQuery

func (*SpyQueryEngine) LabelsQuery

func (*SpyQueryEngine) RangeQuery

func (*SpyQueryEngine) SeriesQuery

type SpyStore

type SpyStore struct {
	GetPoints storage.SeriesSet
	GetErr    error

	Name  string
	Start int64
	End   int64
}

func NewSpyStoreReader

func NewSpyStoreReader() *SpyStore

func (*SpyStore) Get

func (s *SpyStore) Get(params *storage.SelectParams, labelMatchers ...*labels.Matcher) (storage.SeriesSet, error)

func (*SpyStore) Labels

func (s *SpyStore) Labels() (*rpc.PromQL_LabelsQueryResult, error)

Jump to

Keyboard shortcuts

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