fake

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package fake provides stubs for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculate

type Calculate struct {
	GetUsageRatioReplicaCountReactor  func(currentReplicas int32, usageRatio float64, readyPodCount int64) int32
	GetPlainMetricReplicaCountReactor func(metrics podmetrics.MetricsInfo,
		currentReplicas int32,
		targetUtilization int64,
		readyPodCount int64,
		missingPods,
		ignoredPods sets.String) int32
}

Calculate (fake) provides a way to insert functionality into a Calculater

func (*Calculate) GetPlainMetricReplicaCount

func (f *Calculate) GetPlainMetricReplicaCount(metrics podmetrics.MetricsInfo,
	currentReplicas int32,
	targetUtilization int64,
	readyPodCount int64,
	missingPods,
	ignoredPods sets.String) int32

GetPlainMetricReplicaCount calls the fake Calculater function

func (*Calculate) GetUsageRatioReplicaCount

func (f *Calculate) GetUsageRatioReplicaCount(currentReplicas int32, usageRatio float64, readyPodCount int64) int32

GetUsageRatioReplicaCount calls the fake Calculater function

type ExternalEvaluater

type ExternalEvaluater struct {
	EvaluateReactor func(currentReplicas int32, gatheredMetric *metrics.Metric,
		tolerance float64) (int32, error)
}

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

func (*ExternalEvaluater) Evaluate

func (f *ExternalEvaluater) Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric,
	tolerance float64) (int32, error)

Evaluate calls the fake ExternalEvaluater function

type ExternalGatherer

type ExternalGatherer struct {
	GatherReactor       func(metricName, namespace string, metricSelector *metav1.LabelSelector, podSelector labels.Selector) (*externalmetrics.Metric, error)
	GatherPerPodReactor func(metricName, namespace string, metricSelector *metav1.LabelSelector) (*externalmetrics.Metric, error)
}

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

func (*ExternalGatherer) Gather

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

Gather calls the fake ExternalGatherer function

func (*ExternalGatherer) GatherPerPod

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

GatherPerPod calls the fake ExternalGatherer function

type MetricsClient

type MetricsClient struct {
	GetResourceMetricReactor func(resource corev1.ResourceName, namespace string, selector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)
	GetRawMetricReactor      func(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)
	GetObjectMetricReactor   func(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference, metricSelector labels.Selector) (int64, time.Time, error)
	GetExternalMetricReactor func(metricName string, namespace string, selector labels.Selector) ([]int64, time.Time, error)
}

MetricsClient (fake) provides a way to insert functionality into a metricsclient

func (*MetricsClient) GetExternalMetric

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

GetExternalMetric calls the fake metricsclient function

func (*MetricsClient) GetObjectMetric

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

GetObjectMetric calls the fake metricsclient function

func (*MetricsClient) GetRawMetric

func (f *MetricsClient) GetRawMetric(metricName string, namespace string, selector labels.Selector, metricSelector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)

GetRawMetric calls the fake metricsclient function

func (*MetricsClient) GetResourceMetric

func (f *MetricsClient) GetResourceMetric(resource corev1.ResourceName, namespace string, selector labels.Selector) (podmetrics.MetricsInfo, time.Time, error)

GetResourceMetric calls the fake metricsclient function

type ObjectEvaluater

type ObjectEvaluater struct {
	EvaluateReactor func(currentReplicas int32, gatheredMetric *metrics.Metric, tolerance float64) (int32, error)
}

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

func (*ObjectEvaluater) Evaluate

func (f *ObjectEvaluater) Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric,
	tolerance float64) (int32, error)

Evaluate calls the fake ObjectEvaluater function

type ObjectGatherer

type ObjectGatherer struct {
	GatherReactor func(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference,
		podSelector labels.Selector, metricSelector labels.Selector) (*objectmetrics.Metric, error)
	GatherPerPodReactor func(metricName string, namespace string, objectRef *autoscalingv2.CrossVersionObjectReference,
		metricSelector labels.Selector) (*objectmetrics.Metric, error)
}

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

func (*ObjectGatherer) Gather

func (f *ObjectGatherer) Gather(metricName string, namespace string,
	objectRef *autoscalingv2.CrossVersionObjectReference, podSelector labels.Selector,
	metricSelector labels.Selector) (*objectmetrics.Metric, error)

Gather calls the fake ObjectGatherer function

func (*ObjectGatherer) GatherPerPod

func (f *ObjectGatherer) GatherPerPod(metricName string, namespace string,
	objectRef *autoscalingv2.CrossVersionObjectReference,
	metricSelector labels.Selector) (*objectmetrics.Metric, error)

GatherPerPod calls the fake ObjectGatherer function

type PodLister

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

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

List calls the fake PodLister function

func (*PodLister) Pods

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

Pods calls the fake PodLister function

type PodNamespaceLister

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

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

Get calls the fake PodNamespaceLister function

func (*PodNamespaceLister) List

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

List calls the fake PodNamespaceLister function

type PodReadyCounter

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

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

GetReadyPodsCount calls the fake PodReadyCounter function

type PodsEvaluater

type PodsEvaluater struct {
	EvaluateReactor func(currentReplicas int32, gatheredMetric *metrics.Metric) int32
}

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

func (*PodsEvaluater) Evaluate

func (f *PodsEvaluater) Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric) int32

Evaluate calls the fake PodsEvaluater function

type PodsGatherer

type PodsGatherer struct {
	GatherReactor func(metricName string, namespace string, podSelector labels.Selector,
		metricSelector labels.Selector) (*podsmetrics.Metric, error)
}

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

func (*PodsGatherer) Gather

func (f *PodsGatherer) Gather(metricName string, namespace string, podSelector labels.Selector,
	metricSelector labels.Selector) (*podsmetrics.Metric, error)

Gather calls the fake PodsGatherer function

type ResourceClient

type ResourceClient struct {
	GetReactor func(apiVersion string, kind string, name string, namespace string) (*unstructured.Unstructured, error)
}

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

func (*ResourceClient) Get

func (u *ResourceClient) Get(apiVersion string, kind string, name string, namespace string) (*unstructured.Unstructured, error)

Get calls the fake ResourceClient reactor method provided

type ResourceEvaluater

type ResourceEvaluater struct {
	EvaluateReactor func(currentReplicas int32, gatheredMetric *metrics.Metric, tolerance float64) (int32, error)
}

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

func (*ResourceEvaluater) Evaluate

func (f *ResourceEvaluater) Evaluate(currentReplicas int32, gatheredMetric *metrics.Metric, tolerance float64) (int32, error)

Evaluate calls the fake ResourceEvaluater function

type ResourceGatherer

type ResourceGatherer struct {
	GatherReactor func(resourceName corev1.ResourceName, namespace string, podSelector labels.Selector,
		cpuInitializationPeriod time.Duration,
		delayOfInitialReadinessStatus time.Duration) (*resourcemetrics.Metric, error)
	GatherRawReactor func(resourceName corev1.ResourceName, namespace string, podSelector labels.Selector,
		cpuInitializationPeriod time.Duration,
		delayOfInitialReadinessStatus time.Duration) (*resourcemetrics.Metric, error)
}

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

func (*ResourceGatherer) Gather

func (f *ResourceGatherer) Gather(resourceName corev1.ResourceName, namespace string, podSelector labels.Selector,
	cpuInitializationPeriod time.Duration,
	delayOfInitialReadinessStatus time.Duration) (*resourcemetrics.Metric, error)

Gather calls the fake ResourceGatherer function

func (*ResourceGatherer) GatherRaw

func (f *ResourceGatherer) GatherRaw(resourceName corev1.ResourceName, namespace string, podSelector labels.Selector,
	cpuInitializationPeriod time.Duration,
	delayOfInitialReadinessStatus time.Duration) (*resourcemetrics.Metric, error)

GatherRaw calls the fake ResourceGatherer function

Jump to

Keyboard shortcuts

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