testing

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 AssetDigest added in v1.4.1

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest 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, and 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 AssetString added in v1.4.1

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

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 Digests added in v1.4.1

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

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 MustAssetString added in v1.4.1

func MustAssetString(name string) string

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

func MutualTLSClientConfig

func MutualTLSClientConfig() *tls.Config

func MutualTLSServerConfig

func MutualTLSServerConfig() *tls.Config

func NewQueryEngine

func NewQueryEngine() *promql.Engine

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(healthPort string, tlsConfig *tls.Config)

Types

type AlertManagerSpy

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

func NewAlertManagerSpy

func NewAlertManagerSpy(tlsConfig *tls.Config) *AlertManagerSpy

func (*AlertManagerSpy) Addr

func (a *AlertManagerSpy) Addr() string

func (*AlertManagerSpy) AlertsReceived

func (a *AlertManagerSpy) AlertsReceived() int64

func (*AlertManagerSpy) LastAlertReceived

func (a *AlertManagerSpy) LastAlertReceived() string

func (*AlertManagerSpy) Start

func (a *AlertManagerSpy) Start()

func (*AlertManagerSpy) Stop

func (a *AlertManagerSpy) Stop()

type Point

type Point struct {
	Time  int64
	Value float64
}

type PromRuleManagersSpy

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

func NewPromRuleManagersSpy

func NewPromRuleManagersSpy() *PromRuleManagersSpy

func (*PromRuleManagersSpy) AlertingRules

func (p *PromRuleManagersSpy) AlertingRules() []*prom_rules.AlertingRule

func (*PromRuleManagersSpy) Alertmanagers

func (p *PromRuleManagersSpy) Alertmanagers() []*url.URL

func (*PromRuleManagersSpy) Create

func (*PromRuleManagersSpy) Delete

func (p *PromRuleManagersSpy) Delete(managerId string) error

func (*PromRuleManagersSpy) DeleteAll

func (p *PromRuleManagersSpy) DeleteAll() error

func (*PromRuleManagersSpy) DroppedAlertmanagers

func (p *PromRuleManagersSpy) DroppedAlertmanagers() []*url.URL

func (*PromRuleManagersSpy) ManagerIds

func (p *PromRuleManagersSpy) ManagerIds() []string

func (*PromRuleManagersSpy) Reload

func (p *PromRuleManagersSpy) Reload() error

func (*PromRuleManagersSpy) RuleGroups

func (p *PromRuleManagersSpy) RuleGroups() []*prom_rules.Group

type RuleManagerSpy

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

func NewRuleManagerSpy

func NewRuleManagerSpy() *RuleManagerSpy

func (*RuleManagerSpy) AddDroppedAlertmanagers

func (r *RuleManagerSpy) AddDroppedAlertmanagers(urls []*url.URL)

func (*RuleManagerSpy) AlertingRules

func (r *RuleManagerSpy) AlertingRules() []*prom_rules.AlertingRule

func (*RuleManagerSpy) Alertmanagers

func (r *RuleManagerSpy) Alertmanagers() []*url.URL

func (*RuleManagerSpy) CreateManager

func (r *RuleManagerSpy) CreateManager(managerId string, alertManagers *prom_config.AlertmanagerConfigs) (*rules.Manager, error)

func (*RuleManagerSpy) DeleteManager

func (r *RuleManagerSpy) DeleteManager(managerId string) error

func (*RuleManagerSpy) DroppedAlertmanagers

func (r *RuleManagerSpy) DroppedAlertmanagers() []*url.URL

func (*RuleManagerSpy) ManagerIds

func (r *RuleManagerSpy) ManagerIds() []string

func (*RuleManagerSpy) MethodsCalled

func (r *RuleManagerSpy) MethodsCalled() []string

func (*RuleManagerSpy) RuleGroupForManager

func (r *RuleManagerSpy) RuleGroupForManager(managerId string) *rulesclient.RuleGroup

func (*RuleManagerSpy) RuleGroups

func (r *RuleManagerSpy) RuleGroups() []*prom_rules.Group

func (*RuleManagerSpy) UpsertRuleGroup

func (r *RuleManagerSpy) UpsertRuleGroup(managerId string, ruleGroup *rulesclient.RuleGroup) error

type RulesApiError

type RulesApiError struct {
	Title  string `json:"title"`
	Status int    `json:"status"`
}

type RulesApiHttpError

type RulesApiHttpError struct {
	Status int
	Title  string
}

type RulesApiResponse

type RulesApiResponse struct {
	Errors []RulesApiError `json:"errors"`
}

type RulesApiSpy

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

func NewRulesApiSpy

func NewRulesApiSpy(tlsConfig *tls.Config) (*RulesApiSpy, error)

func (*RulesApiSpy) Addr

func (a *RulesApiSpy) Addr() string

func (*RulesApiSpy) LastRequestPath

func (a *RulesApiSpy) LastRequestPath() string

func (*RulesApiSpy) NextRequestError

func (a *RulesApiSpy) NextRequestError(err *RulesApiHttpError)

func (*RulesApiSpy) RequestsReceived

func (a *RulesApiSpy) RequestsReceived() int

func (*RulesApiSpy) Start

func (a *RulesApiSpy) Start() error

func (*RulesApiSpy) Stop

func (a *RulesApiSpy) Stop()

type Series

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

func ExplodeSeriesSet

func ExplodeSeriesSet(seriesSet storage.SeriesSet) []Series

type SpyAdapter

type SpyAdapter struct {
	CommittedPoints []*rpc.Point
}

func NewSpyAdapter

func NewSpyAdapter() *SpyAdapter

func (*SpyAdapter) WritePoints

func (s *SpyAdapter) WritePoints(points []*rpc.Point) error

type SpyHistogramObserver

type SpyHistogramObserver struct {
	sync.Mutex
	Observations []float64
}

func (*SpyHistogramObserver) Observe

func (s *SpyHistogramObserver) Observe(value float64)

type SpyLookup

type SpyLookup struct {
	HashKeys []string
	Results  map[string][]int
	// contains filtered or unexported fields
}

func NewSpyLookup

func NewSpyLookup() *SpyLookup

func (*SpyLookup) GetHashKeys

func (s *SpyLookup) GetHashKeys() []string

func (*SpyLookup) Lookup

func (s *SpyLookup) Lookup(hashKey string) []int

type SpyMetricRegistrar

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

func NewSpyMetricRegistrar

func NewSpyMetricRegistrar() *SpyMetricRegistrar

func (*SpyMetricRegistrar) Add

func (r *SpyMetricRegistrar) Add(name string, delta float64, labels ...string)

func (*SpyMetricRegistrar) Fetch

func (r *SpyMetricRegistrar) Fetch(name string) func() float64

func (*SpyMetricRegistrar) FetchHistogram

func (r *SpyMetricRegistrar) FetchHistogram(name string) func() []float64

func (*SpyMetricRegistrar) FetchOption

func (r *SpyMetricRegistrar) FetchOption(name string) func() *float64

func (*SpyMetricRegistrar) Gatherer

func (r *SpyMetricRegistrar) Gatherer() prometheus.Gatherer

func (*SpyMetricRegistrar) Histogram

func (r *SpyMetricRegistrar) Histogram(name string) prometheus.Observer

func (*SpyMetricRegistrar) Inc

func (r *SpyMetricRegistrar) Inc(name string, labels ...string)

func (*SpyMetricRegistrar) Registerer

func (r *SpyMetricRegistrar) Registerer() prometheus.Registerer

func (*SpyMetricRegistrar) Set

func (r *SpyMetricRegistrar) Set(name string, value float64, labels ...string)

type SpyMetricStore

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

func NewSpyMetricStore

func NewSpyMetricStore(tlsConfig *tls.Config) *SpyMetricStore

func (*SpyMetricStore) GetInternodePoints

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

func (*SpyMetricStore) GetLocalOnlyValues

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

func (*SpyMetricStore) GetPoints

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

func (*SpyMetricStore) Resume

func (s *SpyMetricStore) Resume()

func (*SpyMetricStore) SetValue

func (s *SpyMetricStore) SetValue(value float64)

func (*SpyMetricStore) Start

func (*SpyMetricStore) Stop

func (s *SpyMetricStore) Stop()

type SpyMetricStoreAddrs

type SpyMetricStoreAddrs struct {
	EgressAddr    string
	IngressAddr   string
	InternodeAddr string
}

type SpyStorage

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

func NewSpyStorage

func NewSpyStorage(querier storage.Querier) *SpyStorage

func (*SpyStorage) Appender

func (s *SpyStorage) Appender() (storage.Appender, error)

func (*SpyStorage) Close

func (s *SpyStorage) Close() error

func (*SpyStorage) Querier

func (s *SpyStorage) Querier(ctx context.Context, mint int64, maxt int64) (storage.Querier, error)

func (*SpyStorage) StartTime

func (s *SpyStorage) StartTime() (int64, error)

type SpyStore

type SpyStore struct {
	GetPoints storage.SeriesSet
	GetErr    error

	Name  string
	Start int64
	End   int64
}

func NewSpyStoreReader

func NewSpyStoreReader() *SpyStore

func (*SpyStore) Close

func (s *SpyStore) Close() error

func (*SpyStore) LabelNames

func (s *SpyStore) LabelNames() ([]string, error)

func (*SpyStore) LabelValues

func (s *SpyStore) LabelValues(string) ([]string, error)

func (*SpyStore) Select

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

type SpyTCPClient

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

func NewSpyTCPClient

func NewSpyTCPClient() *SpyTCPClient

func (*SpyTCPClient) GetPoints

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

func (*SpyTCPClient) SetErr

func (s *SpyTCPClient) SetErr(err error)

func (*SpyTCPClient) Write

func (s *SpyTCPClient) Write(data []byte) (int, error)

type SpyTCPListener

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

func NewSpyTCPListener

func NewSpyTCPListener(tlsConfig *tls.Config) *SpyTCPListener

func (*SpyTCPListener) Address

func (s *SpyTCPListener) Address() string

func (*SpyTCPListener) GetPoints

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

func (*SpyTCPListener) Resume

func (s *SpyTCPListener) Resume() error

func (*SpyTCPListener) Start

func (s *SpyTCPListener) Start() error

func (*SpyTCPListener) Stop

func (s *SpyTCPListener) Stop()

type SpyUAA

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

func NewSpyUAA

func NewSpyUAA(tlsConfig *tls.Config) *SpyUAA

func (*SpyUAA) Start

func (s *SpyUAA) Start() error

func (*SpyUAA) Url

func (s *SpyUAA) Url() string

type TempStorage

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

func NewTempStorage

func NewTempStorage() TempStorage

func (TempStorage) Cleanup

func (s TempStorage) Cleanup()

func (TempStorage) Directories added in v1.4.0

func (s TempStorage) Directories() []string

func (TempStorage) Directory added in v1.4.1

func (s TempStorage) Directory(p string) []string

func (TempStorage) FileNames

func (s TempStorage) FileNames() []string

func (TempStorage) Path

func (s TempStorage) Path() string

Jump to

Keyboard shortcuts

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