kubernetes/pkg/controller/podautoscaler/horizontal_test.go

var statusOk

// statusOkWithOverrides returns the "ok" status with the given conditions as overridden
func statusOkWithOverrides(overrides ...autoscalingv2.HorizontalPodAutoscalerCondition) []autoscalingv2.HorizontalPodAutoscalerCondition {}

func alwaysReady() bool {}

type fakeResource

type testCase

// Needs to be called under a lock.
func (tc *testCase) computeCPUCurrent() {}

func init() {}

func (tc *testCase) prepareTestClient(t *testing.T) (*fake.Clientset, *metricsfake.Clientset, *cmfake.FakeCustomMetricsClient, *emfake.FakeExternalMetricsClient, *scalefake.FakeScaleClient) {}

func findCpuUtilization(metricStatus []autoscalingv2.MetricStatus) (utilization *int32) {}

func (tc *testCase) verifyResults(t *testing.T, m *mockMonitor) {}

func (tc *testCase) verifyRecordedMetric(t *testing.T, m *mockMonitor) {}

func (tc *testCase) setupController(t *testing.T) (*HorizontalController, informers.SharedInformerFactory) {}

func hotCPUCreationTime() metav1.Time {}

func coolCPUCreationTime() metav1.Time {}

func (tc *testCase) runTestWithController(t *testing.T, hpaController *HorizontalController, informerFactory informers.SharedInformerFactory) {}

func (tc *testCase) runTest(t *testing.T) {}

type mockMonitor

func newMockMonitor() *mockMonitor {}

func (m *mockMonitor) ObserveReconciliationResult(action monitor.ActionLabel, err monitor.ErrorLabel, _ time.Duration) {}

func (m *mockMonitor) ObserveMetricComputationResult(action monitor.ActionLabel, err monitor.ErrorLabel, duration time.Duration, metricType autoscalingv2.MetricSourceType) {}

// waitUntilRecorded waits for the HPA controller to reconcile at least once.
func (m *mockMonitor) waitUntilRecorded(t *testing.T) {}

func TestScaleUp(t *testing.T) {}

func TestScaleUpContainer(t *testing.T) {}

func TestScaleUpUnreadyLessScale(t *testing.T) {}

func TestScaleUpHotCpuLessScale(t *testing.T) {}

func TestScaleUpUnreadyNoScale(t *testing.T) {}

func TestScaleUpHotCpuNoScale(t *testing.T) {}

func TestScaleUpIgnoresFailedPods(t *testing.T) {}

func TestScaleUpIgnoresDeletionPods(t *testing.T) {}

func TestScaleUpDeployment(t *testing.T) {}

func TestScaleUpReplicaSet(t *testing.T) {}

func TestScaleUpCM(t *testing.T) {}

func TestScaleUpCMUnreadyAndHotCpuNoLessScale(t *testing.T) {}

func TestScaleUpCMUnreadyandCpuHot(t *testing.T) {}

func TestScaleUpHotCpuNoScaleWouldScaleDown(t *testing.T) {}

func TestScaleUpCMObject(t *testing.T) {}

func TestScaleUpFromZeroCMObject(t *testing.T) {}

func TestScaleUpFromZeroIgnoresToleranceCMObject(t *testing.T) {}

func TestScaleUpPerPodCMObject(t *testing.T) {}

func TestScaleUpCMExternal(t *testing.T) {}

func TestScaleUpPerPodCMExternal(t *testing.T) {}

func TestScaleDown(t *testing.T) {}

func TestScaleDownContainerResource(t *testing.T) {}

func TestScaleDownWithScalingRules(t *testing.T) {}

func TestScaleUpOneMetricInvalid(t *testing.T) {}

func TestScaleUpFromZeroOneMetricInvalid(t *testing.T) {}

func TestScaleUpBothMetricsEmpty(t *testing.T) {}

func TestScaleDownStabilizeInitialSize(t *testing.T) {}

func TestScaleDownCM(t *testing.T) {}

func TestScaleDownCMObject(t *testing.T) {}

func TestScaleDownToZeroCMObject(t *testing.T) {}

func TestScaleDownPerPodCMObject(t *testing.T) {}

func TestScaleDownCMExternal(t *testing.T) {}

func TestScaleDownToZeroCMExternal(t *testing.T) {}

func TestScaleDownPerPodCMExternal(t *testing.T) {}

func TestScaleDownIncludeUnreadyPods(t *testing.T) {}

func TestScaleDownIgnoreHotCpuPods(t *testing.T) {}

func TestScaleDownIgnoresFailedPods(t *testing.T) {}

func TestScaleDownIgnoresDeletionPods(t *testing.T) {}

func TestTolerance(t *testing.T) {}

func TestToleranceCM(t *testing.T) {}

func TestToleranceCMObject(t *testing.T) {}

func TestToleranceCMExternal(t *testing.T) {}

func TestTolerancePerPodCMObject(t *testing.T) {}

func TestTolerancePerPodCMExternal(t *testing.T) {}

func TestMinReplicas(t *testing.T) {}

func TestZeroMinReplicasDesiredZero(t *testing.T) {}

func TestMinReplicasDesiredZero(t *testing.T) {}

func TestZeroReplicas(t *testing.T) {}

func TestTooFewReplicas(t *testing.T) {}

func TestTooManyReplicas(t *testing.T) {}

func TestMaxReplicas(t *testing.T) {}

func TestSuperfluousMetrics(t *testing.T) {}

func TestMissingMetrics(t *testing.T) {}

func TestEmptyMetrics(t *testing.T) {}

func TestEmptyCPURequest(t *testing.T) {}

func TestEventCreated(t *testing.T) {}

func TestEventNotCreated(t *testing.T) {}

func TestMissingReports(t *testing.T) {}

func TestUpscaleCap(t *testing.T) {}

func TestUpscaleCapGreaterThanMaxReplicas(t *testing.T) {}

func TestMoreReplicasThanSpecNoScale(t *testing.T) {}

func TestConditionInvalidSelectorMissing(t *testing.T) {}

func TestConditionInvalidSelectorUnparsable(t *testing.T) {}

func TestConditionNoAmbiguousSelectorWhenNoSelectorOverlapBetweenHPAs(t *testing.T) {}

func TestConditionAmbiguousSelectorWhenFullSelectorOverlapBetweenHPAs(t *testing.T) {}

func TestConditionAmbiguousSelectorWhenPartialSelectorOverlapBetweenHPAs(t *testing.T) {}

func TestConditionFailedGetMetrics(t *testing.T) {}

func TestConditionInvalidSourceType(t *testing.T) {}

func TestConditionFailedGetScale(t *testing.T) {}

func TestConditionFailedUpdateScale(t *testing.T) {}

func TestNoBackoffUpscaleCM(t *testing.T) {}

func TestNoBackoffUpscaleCMNoBackoffCpu(t *testing.T) {}

func TestStabilizeDownscale(t *testing.T) {}

// TestComputedToleranceAlgImplementation is a regression test which
// back-calculates a minimal percentage for downscaling based on a small percentage
// increase in pod utilization which is calibrated against the tolerance value.
func TestComputedToleranceAlgImplementation(t *testing.T) {}

func TestScaleUpRCImmediately(t *testing.T) {}

func TestScaleDownRCImmediately(t *testing.T) {}

func TestAvoidUnnecessaryUpdates(t *testing.T) {}

func TestConvertDesiredReplicasWithRules(t *testing.T) {}

func TestCalculateScaleUpLimitWithScalingRules(t *testing.T) {}

func TestCalculateScaleDownLimitWithBehaviors(t *testing.T) {}

func generateScalingRules(pods, podsPeriod, percent, percentPeriod, stabilizationWindow int32) *autoscalingv2.HPAScalingRules {}

// generateEventsUniformDistribution generates events that uniformly spread in the time window
//
//	time.Now()-periodSeconds  ; time.Now()
//
// It split the time window into several segments (by the number of events) and put the event in the center of the segment
// it is needed if you want to create events for several policies (to check how "outdated" flag is set).
// E.g. generateEventsUniformDistribution([]int{1,2,3,4}, 120) will spread events uniformly for the last 120 seconds:
//
//	1          2          3          4
//
// -----------------------------------------------
//
//	^          ^          ^          ^          ^
//
// -120s      -90s       -60s       -30s       now()
// And we can safely have two different stabilizationWindows:
//   - 60s (guaranteed to have last half of events)
//   - 120s (guaranteed to have all events)
func generateEventsUniformDistribution(rawEvents []int, periodSeconds int) []timestampedScaleEvent {}

func TestNormalizeDesiredReplicas(t *testing.T) {}

func TestScalingWithRules(t *testing.T) {}

// TestStoreScaleEvents tests events storage and usage
func TestStoreScaleEvents(t *testing.T) {}

func TestNormalizeDesiredReplicasWithBehavior(t *testing.T) {}

func TestScaleUpOneMetricEmpty(t *testing.T) {}

func TestNoScaleDownOneMetricInvalid(t *testing.T) {}

func TestNoScaleDownOneMetricEmpty(t *testing.T) {}

func TestMultipleHPAs(t *testing.T) {}