testing

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNDEFINED_METRIC float64 = 99999999999
)

Variables

View Source
var LogCacheTestCerts = GenerateCerts("log-cache-ca")

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 FormatTimeWithDecimalMillis

func FormatTimeWithDecimalMillis(t time.Time) string

func GetFreePort

func GetFreePort() int

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 NewServerRequest

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

func NewTLSConfig

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

func ParseTimeWithDecimalMillis

func ParseTimeWithDecimalMillis(t string) time.Time

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 StubUptimeFn

func StubUptimeFn() int64

Types

type SpyAgent

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

func NewSpyAgent

func NewSpyAgent(tlsConfig *tls.Config) *SpyAgent

func (*SpyAgent) BatchSender

func (*SpyAgent) GetEnvelopes

func (s *SpyAgent) GetEnvelopes() []*loggregator_v2.Envelope

func (*SpyAgent) Send

func (*SpyAgent) Sender

func (*SpyAgent) Start

func (s *SpyAgent) Start() string

type SpyLogCache

type SpyLogCache struct {
	QueryError error

	ReadEnvelopes map[string]func() []*loggregator_v2.Envelope
	MetaResponses map[string]*rpc.MetaInfo
	// contains filtered or unexported fields
}

func NewSpyLogCache

func NewSpyLogCache(tlsConfig *tls.Config) *SpyLogCache

func (*SpyLogCache) GetEnvelopes

func (s *SpyLogCache) GetEnvelopes() []*loggregator_v2.Envelope

func (*SpyLogCache) GetLocalOnlyValues

func (s *SpyLogCache) GetLocalOnlyValues() []bool

func (*SpyLogCache) GetQueryRequests

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

func (*SpyLogCache) GetRangeQueryRequests

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

func (*SpyLogCache) GetReadRequests

func (s *SpyLogCache) GetReadRequests() []*rpc.ReadRequest

func (*SpyLogCache) Meta

func (*SpyLogCache) RangeQuery

func (*SpyLogCache) Read

func (*SpyLogCache) Send

func (*SpyLogCache) SetValue

func (s *SpyLogCache) SetValue(value float64)

func (*SpyLogCache) Start

func (s *SpyLogCache) 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) NewPerNodeCounter

func (s *SpyMetrics) NewPerNodeCounter(name string, nodeIndex int) func(uint64)

func (*SpyMetrics) NewSummary

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

func (*SpyMetrics) SummaryObservationsGetter

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

type TestCerts

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

func GenerateCerts

func GenerateCerts(caName string) *TestCerts

func (*TestCerts) CA

func (tc *TestCerts) CA() string

func (*TestCerts) Cert

func (tc *TestCerts) Cert(commonName string) string

func (*TestCerts) Key

func (tc *TestCerts) Key(commonName string) string

func (*TestCerts) Pool

func (tc *TestCerts) Pool() *x509.CertPool

Jump to

Keyboard shortcuts

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