mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Merge pull request #137175 from adrianmoisey/tweak-hpa-e2e-tests
Mark some HPA slow e2e tests as slow
This commit is contained in:
@@ -48,7 +48,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (scale resource: CP
|
||||
f := framework.NewDefaultFramework("horizontal-pod-autoscaling")
|
||||
f.NamespacePodSecurityLevel = api.LevelBaseline
|
||||
|
||||
f.Describe("Deployment (Pod Resource)", func() {
|
||||
f.Describe("Deployment (Pod Resource)", framework.WithSlow(), func() {
|
||||
ginkgo.It(titleUp+titleAverageUtilization, func(ctx context.Context) {
|
||||
scaleUp(ctx, "test-deployment", e2eautoscaling.KindDeployment, cpuResource, utilizationMetricType, false, f)
|
||||
})
|
||||
@@ -81,7 +81,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (scale resource: CP
|
||||
})
|
||||
})
|
||||
|
||||
f.Describe("ReplicaSet", func() {
|
||||
f.Describe("ReplicaSet", framework.WithSlow(), func() {
|
||||
ginkgo.It(titleUp, func(ctx context.Context) {
|
||||
scaleUp(ctx, "rs", e2eautoscaling.KindReplicaSet, cpuResource, utilizationMetricType, false, f)
|
||||
})
|
||||
@@ -91,7 +91,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (scale resource: CP
|
||||
})
|
||||
|
||||
// These tests take ~20 minutes each.
|
||||
f.Describe("ReplicaSet", func() {
|
||||
f.Describe("ReplicaSet", framework.WithSlow(), func() {
|
||||
ginkgo.It(titleUp+" and verify decision stability", func(ctx context.Context) {
|
||||
scaleUp(ctx, "rs", e2eautoscaling.KindReplicaSet, cpuResource, utilizationMetricType, true, f)
|
||||
})
|
||||
@@ -211,9 +211,10 @@ type HPAScaleTest struct {
|
||||
func (st *HPAScaleTest) run(ctx context.Context, name string, kind schema.GroupVersionKind, f *framework.Framework) {
|
||||
const timeToWait = 15 * time.Minute
|
||||
initCPUTotal, initMemTotal := 0, 0
|
||||
if st.resourceType == cpuResource {
|
||||
switch st.resourceType {
|
||||
case cpuResource:
|
||||
initCPUTotal = st.initCPUTotal
|
||||
} else if st.resourceType == memResource {
|
||||
case memResource:
|
||||
initMemTotal = st.initMemTotal
|
||||
}
|
||||
rc := e2eautoscaling.NewDynamicResourceConsumer(ctx, name, f.Namespace.Name, kind, st.initPods, initCPUTotal, initMemTotal, 0, st.perPodCPURequest, st.perPodMemRequest, f.ClientSet, f.ScalesGetter, e2eautoscaling.Disable, e2eautoscaling.Idle, nil)
|
||||
@@ -319,9 +320,10 @@ type HPAContainerResourceScaleTest struct {
|
||||
func (st *HPAContainerResourceScaleTest) run(ctx context.Context, name string, kind schema.GroupVersionKind, f *framework.Framework) {
|
||||
const timeToWait = 15 * time.Minute
|
||||
initCPUTotal, initMemTotal := 0, 0
|
||||
if st.resourceType == cpuResource {
|
||||
switch st.resourceType {
|
||||
case cpuResource:
|
||||
initCPUTotal = st.initCPUTotal
|
||||
} else if st.resourceType == memResource {
|
||||
case memResource:
|
||||
initMemTotal = st.initMemTotal
|
||||
}
|
||||
rc := e2eautoscaling.NewDynamicResourceConsumer(ctx, name, f.Namespace.Name, kind, st.initPods, initCPUTotal, initMemTotal, 0, st.perContainerCPURequest, st.perContainerMemRequest, f.ClientSet, f.ScalesGetter, st.sidecarStatus, st.sidecarType, nil)
|
||||
|
||||
@@ -88,7 +88,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
rc.ConsumeCPU(usageForReplicas(2))
|
||||
waitStart := time.Now()
|
||||
rc.WaitForReplicas(ctx, 2, downScaleStabilization+maxHPAReactionTime+maxResourceConsumerDelay+waitBuffer)
|
||||
timeWaited := time.Now().Sub(waitStart)
|
||||
timeWaited := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale down")
|
||||
framework.Logf("time waited for scale down: %s", timeWaited)
|
||||
@@ -129,7 +129,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
rc.ConsumeCPU(usageForReplicas(3))
|
||||
waitStart := time.Now()
|
||||
rc.WaitForReplicas(ctx, 3, upScaleStabilization+maxHPAReactionTime+maxResourceConsumerDelay+waitBuffer)
|
||||
timeWaited := time.Now().Sub(waitStart)
|
||||
timeWaited := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale up")
|
||||
framework.Logf("time waited for scale up: %s", timeWaited)
|
||||
@@ -164,7 +164,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
waitStart := time.Now()
|
||||
|
||||
rc.EnsureDesiredReplicasInRange(ctx, initPods, initPods, waitDeadline, hpa.Name)
|
||||
timeWaited := time.Now().Sub(waitStart)
|
||||
timeWaited := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale up")
|
||||
framework.Logf("time waited for scale up: %s", timeWaited)
|
||||
@@ -201,7 +201,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
waitStart := time.Now()
|
||||
|
||||
rc.EnsureDesiredReplicasInRange(ctx, initPods, initPods, waitDeadline, hpa.Name)
|
||||
timeWaited := time.Now().Sub(waitStart)
|
||||
timeWaited := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale down")
|
||||
framework.Logf("time waited for scale down: %s", timeWaited)
|
||||
@@ -241,11 +241,11 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
|
||||
waitStart := time.Now()
|
||||
rc.WaitForReplicas(ctx, 2, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor2 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor2 := time.Since(waitStart)
|
||||
|
||||
waitStart = time.Now()
|
||||
rc.WaitForReplicas(ctx, 3, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor3 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor3 := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale up to 2 replicas")
|
||||
deadline := limitWindowLength + maxHPAReactionTime + maxResourceConsumerDelay
|
||||
@@ -283,11 +283,11 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
|
||||
waitStart := time.Now()
|
||||
rc.WaitForReplicas(ctx, 2, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor2 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor2 := time.Since(waitStart)
|
||||
|
||||
waitStart = time.Now()
|
||||
rc.WaitForReplicas(ctx, 1, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor1 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor1 := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale down to 2 replicas")
|
||||
deadline := limitWindowLength + maxHPAReactionTime + maxResourceConsumerDelay
|
||||
@@ -327,12 +327,12 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
|
||||
waitStart := time.Now()
|
||||
rc.WaitForReplicas(ctx, 3, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor3 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor3 := time.Since(waitStart)
|
||||
|
||||
waitStart = time.Now()
|
||||
// Scale up limited by percentage takes ceiling, so new replicas number is ceil(3 * 1.5) = ceil(4.5) = 5
|
||||
rc.WaitForReplicas(ctx, 5, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor5 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor5 := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale up to 3 replicas")
|
||||
deadline := limitWindowLength + maxHPAReactionTime + maxResourceConsumerDelay
|
||||
@@ -370,12 +370,12 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
|
||||
waitStart := time.Now()
|
||||
rc.WaitForReplicas(ctx, 5, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor5 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor5 := time.Since(waitStart)
|
||||
|
||||
waitStart = time.Now()
|
||||
// Scale down limited by percentage takes floor, so new replicas number is floor(5 * 0.75) = floor(3.75) = 3
|
||||
rc.WaitForReplicas(ctx, 3, maxHPAReactionTime+maxResourceConsumerDelay+limitWindowLength)
|
||||
timeWaitedFor3 := time.Now().Sub(waitStart)
|
||||
timeWaitedFor3 := time.Since(waitStart)
|
||||
|
||||
ginkgo.By("verifying time waited for a scale down to 5 replicas")
|
||||
deadline := limitWindowLength + maxHPAReactionTime + maxResourceConsumerDelay
|
||||
@@ -423,7 +423,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
waitStart := time.Now()
|
||||
waitDeadline = maxHPAReactionTime + maxResourceConsumerDelay + waitBuffer
|
||||
rc.WaitForReplicas(ctx, 3, waitDeadline)
|
||||
timeWaited := time.Now().Sub(waitStart)
|
||||
timeWaited := time.Since(waitStart)
|
||||
framework.Logf("time waited for scale up: %s", timeWaited)
|
||||
gomega.Expect(timeWaited).To(gomega.BeNumerically("<", waitDeadline), "waited %s, wanted less than %s", timeWaited, waitDeadline)
|
||||
|
||||
@@ -438,7 +438,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
waitStart = time.Now()
|
||||
waitDeadline = maxHPAReactionTime + maxResourceConsumerDelay + waitBuffer
|
||||
rc.WaitForReplicas(ctx, 2, waitDeadline)
|
||||
timeWaited = time.Now().Sub(waitStart)
|
||||
timeWaited = time.Since(waitStart)
|
||||
framework.Logf("time waited for scale down: %s", timeWaited)
|
||||
gomega.Expect(timeWaited).To(gomega.BeNumerically("<", waitDeadline), "waited %s, wanted less than %s", timeWaited, waitDeadline)
|
||||
})
|
||||
@@ -477,7 +477,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
waitStart := time.Now()
|
||||
waitDeadline = limitWindowLength + maxHPAReactionTime + maxResourceConsumerDelay + waitBuffer
|
||||
rc.WaitForReplicas(ctx, 4, waitDeadline)
|
||||
timeWaited := time.Now().Sub(waitStart)
|
||||
timeWaited := time.Since(waitStart)
|
||||
framework.Logf("time waited for scale up: %s", timeWaited)
|
||||
gomega.Default.Expect(timeWaited).To(gomega.BeNumerically("<", waitDeadline), "waited %s, wanted less than %s", timeWaited, waitDeadline)
|
||||
|
||||
@@ -492,7 +492,7 @@ var _ = SIGDescribe(feature.HPA, "Horizontal pod autoscaling (non-default behavi
|
||||
waitStart = time.Now()
|
||||
waitDeadline = maxHPAReactionTime + maxResourceConsumerDelay + waitBuffer
|
||||
rc.WaitForReplicas(ctx, 2, waitDeadline)
|
||||
timeWaited = time.Now().Sub(waitStart)
|
||||
timeWaited = time.Since(waitStart)
|
||||
framework.Logf("time waited for scale down: %s", timeWaited)
|
||||
gomega.Expect(timeWaited).To(gomega.BeNumerically("<", waitDeadline), "waited %s, wanted less than %s", timeWaited, waitDeadline)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user