fake

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TestRevision is the name used for the revision.
	TestRevision = "test-revision"
	// TestService is the name used for the service.
	TestService = "test-revision-metrics"
	// TestNamespace is the name used for the namespace.
	TestNamespace = "test-namespace"
	// TestConfig is the name used for the config.
	TestConfig = "test-config"
)

Variables

View Source
var (
	// KubeClient holds instances of interfaces for making requests to kubernetes client.
	KubeClient = fakek8s.NewSimpleClientset()
	// KubeInformer constructs a new instance of sharedInformerFactory for all namespaces.
	KubeInformer = kubeinformers.NewSharedInformerFactory(KubeClient, 0)
)
View Source
var StaticMetricClient = MetricClient{
	StableConcurrency: 10.0,
	PanicConcurrency:  10.0,
	StableRPS:         10.0,
	PanicRPS:          10.0,
}

StaticMetricClient returns stable/panic concurrency and RPS with static value, i.e. 10.

Functions

func Endpoints

func Endpoints(count int, svc string)

Endpoints is used to create endpoints.

Types

type ManualTickProvider

type ManualTickProvider struct {
	Channel chan time.Time
}

A ManualTickProvider holds a channel that delivers `ticks' of a clock at intervals.

func (*ManualTickProvider) NewTicker

func (mtp *ManualTickProvider) NewTicker(time.Duration) *time.Ticker

NewTicker returns a Ticker containing a channel that will send the time with a period specified by the duration argument.

type MetricClient

type MetricClient struct {
	StableConcurrency float64
	PanicConcurrency  float64
	StableRPS         float64
	PanicRPS          float64
	ErrF              func(key types.NamespacedName, now time.Time) error
}

MetricClient is a fake implementation of autoscaler.MetricClient for testing.

func (*MetricClient) StableAndPanicConcurrency

func (t *MetricClient) StableAndPanicConcurrency(key types.NamespacedName, now time.Time) (float64, float64, error)

StableAndPanicConcurrency returns stable/panic concurrency stored in the object and the result of Errf as the error.

func (*MetricClient) StableAndPanicRPS

func (t *MetricClient) StableAndPanicRPS(key types.NamespacedName, now time.Time) (float64, float64, error)

StableAndPanicRPS returns stable/panic RPS stored in the object and the result of Errf as the error.

Jump to

Keyboard shortcuts

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