fake

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package fake provides stubs for testing relevant to the Custom Pod Autoscaler packages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Execute

type Execute struct {
	ExecuteWithValueReactor func(method *config.Method, value string) (string, error)
	GetTypeReactor          func() string
}

Execute (fake) allows inserting logic into an executer for testing

func (*Execute) ExecuteWithValue

func (f *Execute) ExecuteWithValue(method *config.Method, value string) (string, error)

ExecuteWithValue calls the fake Execute reactor method provided

func (*Execute) GetType

func (f *Execute) GetType() string

GetType calls the fake Execute reactor method provided

type ExternalGatherer added in v1.1.0

type ExternalGatherer struct {
	GetMetricReactor       func(metricName, namespace string, metricSelector *metav1.LabelSelector, podSelector labels.Selector) (*external.Metric, error)
	GetPerPodMetricReactor func(metricName, namespace string, metricSelector *metav1.LabelSelector) (*external.Metric, error)
}

ExternalGatherer (fake) provides a way to insert functionality into an ExternalGatherer

func (*ExternalGatherer) GetMetric added in v1.1.0

func (f *ExternalGatherer) GetMetric(metricName, namespace string, metricSelector *metav1.LabelSelector, podSelector labels.Selector) (*external.Metric, error)

GetMetric calls the fake ExternalGatherer function

func (*ExternalGatherer) GetPerPodMetric added in v1.1.0

func (f *ExternalGatherer) GetPerPodMetric(metricName, namespace string, metricSelector *metav1.LabelSelector) (*external.Metric, error)

GetPerPodMetric calls the fake ExternalGatherer function

type Gather added in v1.1.0

type Gather struct {
	GetMetricsReactor func(resource metav1.Object, specs []measure.MetricSpec, namespace string) ([]*measure.Metric, error)
}

Gather (fake) provides a way to insert functionality into a Gatherer

func (*Gather) GetMetrics added in v1.1.0

func (f *Gather) GetMetrics(resource metav1.Object, specs []measure.MetricSpec, namespace string) ([]*measure.Metric, error)

GetMetrics calls the fake Gather function

type MetricClient added in v1.1.0

type MetricClient struct {
	GetResourceMetricReactor func(resource corev1.ResourceName, namespace string, selector labels.Selector, container string) (metricsclient.PodMetricsInfo, time.Time, error)
	GetRawMetricReactor      func(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (metricsclient.PodMetricsInfo, time.Time, error)
	GetObjectMetricReactor   func(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, metricSelector labels.Selector) (int64, time.Time, error)
	GetExternalMetricReactor func(metricName string, namespace string, selector labels.Selector) ([]int64, time.Time, error)
}

MetricClient (fake) provides a way to insert functionality into a MetricClient

func (*MetricClient) GetExternalMetric added in v1.1.0

func (f *MetricClient) GetExternalMetric(metricName string, namespace string, selector labels.Selector) ([]int64, time.Time, error)

GetExternalMetric calls the fake MetricClient function

func (*MetricClient) GetObjectMetric added in v1.1.0

func (f *MetricClient) GetObjectMetric(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, metricSelector labels.Selector) (int64, time.Time, error)

GetObjectMetric calls the fake MetricClient function

func (*MetricClient) GetRawMetric added in v1.1.0

func (f *MetricClient) GetRawMetric(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (metricsclient.PodMetricsInfo, time.Time, error)

GetRawMetric calls the fake MetricClient function

func (*MetricClient) GetResourceMetric added in v1.1.0

func (f *MetricClient) GetResourceMetric(resource corev1.ResourceName, namespace string, selector labels.Selector, container string) (metricsclient.PodMetricsInfo, time.Time, error)

GetResourceMetric calls the fake MetricClient function

type ObjectGatherer added in v1.1.0

type ObjectGatherer struct {
	GetMetricReactor       func(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, selector labels.Selector, metricSelector labels.Selector) (*object.Metric, error)
	GetPerPodMetricReactor func(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, metricSelector labels.Selector) (*object.Metric, error)
}

ObjectGatherer (fake) provides a way to insert functionality into an ObjectGatherer

func (*ObjectGatherer) GetMetric added in v1.1.0

func (f *ObjectGatherer) GetMetric(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, selector labels.Selector, metricSelector labels.Selector) (*object.Metric, error)

GetMetric calls the fake ObjectGatherer function

func (*ObjectGatherer) GetPerPodMetric added in v1.1.0

func (f *ObjectGatherer) GetPerPodMetric(metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, metricSelector labels.Selector) (*object.Metric, error)

GetPerPodMetric calls the fake ObjectGatherer function

type PodLister added in v1.1.0

type PodLister struct {
	ListReactor func(selector labels.Selector) (ret []*corev1.Pod, err error)
	PodsReactor func(namespace string) corelisters.PodNamespaceLister
}

PodLister (fake) provides a way to insert functionality into a PodLister

func (*PodLister) List added in v1.1.0

func (f *PodLister) List(selector labels.Selector) (ret []*corev1.Pod, err error)

List calls the fake PodLister function

func (*PodLister) Pods added in v1.1.0

func (f *PodLister) Pods(namespace string) corelisters.PodNamespaceLister

Pods calls the fake PodLister function

type PodNamespaceLister added in v1.1.0

type PodNamespaceLister struct {
	ListReactor func(selector labels.Selector) (ret []*corev1.Pod, err error)
	GetReactor  func(name string) (*corev1.Pod, error)
}

PodNamespaceLister (fake) provides a way to insert functionality into a PodNamespaceLister

func (*PodNamespaceLister) Get added in v1.1.0

func (f *PodNamespaceLister) Get(name string) (*corev1.Pod, error)

Get calls the fake PodNamespaceLister function

func (*PodNamespaceLister) List added in v1.1.0

func (f *PodNamespaceLister) List(selector labels.Selector) (ret []*corev1.Pod, err error)

List calls the fake PodNamespaceLister function

type PodReadyCounter added in v1.1.0

type PodReadyCounter struct {
	GetReadyPodsCountReactor func(namespace string, selector labels.Selector) (int64, error)
}

PodReadyCounter (fake) provides a way to insert functionality into a PodReadyCounter

func (*PodReadyCounter) GetReadyPodsCount added in v1.1.0

func (f *PodReadyCounter) GetReadyPodsCount(namespace string, selector labels.Selector) (int64, error)

GetReadyPodsCount calls the fake PodReadyCounter function

type PodsGatherer added in v1.1.0

type PodsGatherer struct {
	GetMetricReactor func(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (*pods.Metric, error)
}

PodsGatherer (fake) provides a way to insert functionality into an PodsGatherer

func (*PodsGatherer) GetMetric added in v1.1.0

func (f *PodsGatherer) GetMetric(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (*pods.Metric, error)

GetMetric calls the fake PodsGatherer function

type ResourceClient added in v0.9.0

type ResourceClient struct {
	GetReactor func(apiVersion string, kind string, name string, namespace string) (metav1.Object, error)
}

ResourceClient (fake) allows inserting logic into a resource client for testing

func (*ResourceClient) Get added in v0.9.0

func (u *ResourceClient) Get(apiVersion string, kind string, name string, namespace string) (metav1.Object, error)

Get calls the fake ResourceClient reactor method provided

type ResourceGatherer added in v1.1.0

type ResourceGatherer struct {
	GetMetricReactor    func(resource corev1.ResourceName, namespace string, selector labels.Selector) (*resource.Metric, error)
	GetRawMetricReactor func(resource corev1.ResourceName, namespace string, selector labels.Selector) (*resource.Metric, error)
}

ResourceGatherer (fake) provides a way to insert functionality into an ResourceGatherer

func (*ResourceGatherer) GetMetric added in v1.1.0

func (f *ResourceGatherer) GetMetric(resource corev1.ResourceName, namespace string, selector labels.Selector) (*resource.Metric, error)

GetMetric calls the fake ResourceGatherer function

func (*ResourceGatherer) GetRawMetric added in v1.1.0

func (f *ResourceGatherer) GetRawMetric(resource corev1.ResourceName, namespace string, selector labels.Selector) (*resource.Metric, error)

GetRawMetric calls the fake ResourceGatherer function

type Scaler added in v0.10.0

type Scaler struct {
	ScaleReactor func(spec scale.Spec) (*evaluate.Evaluation, error)
}

Scaler (fake) allows inserting logic into a scaler for testing

func (*Scaler) Scale added in v0.10.0

func (s *Scaler) Scale(spec scale.Spec) (*evaluate.Evaluation, error)

Scale calls the fake Scaler reactor method provided

Jump to

Keyboard shortcuts

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