Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using the deprecated Measure method #111065

Merged
merged 1 commit into from Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions test/e2e/autoscaling/autoscaling_timer.go
Expand Up @@ -30,11 +30,13 @@ import (
admissionapi "k8s.io/pod-security-admission/api"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega/gmeasure"
)

var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling", func() {
f := framework.NewDefaultFramework("autoscaling")
f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged
var experiment *gmeasure.Experiment

ginkgo.Describe("Autoscaling a service", func() {
ginkgo.BeforeEach(func() {
Expand All @@ -43,6 +45,8 @@ var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling"
if err != nil {
e2eskipper.Skipf("test expects Cluster Autoscaler to be enabled")
}
experiment = gmeasure.NewExperiment("Autoscaling a service")
ginkgo.AddReportEntry(experiment.Name, experiment)
})

ginkgo.Context("from 1 pod and 3 nodes to 8 pods and >=4 nodes", func() {
Expand Down Expand Up @@ -82,7 +86,7 @@ var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling"
}
})

ginkgo.Measure("takes less than 15 minutes", func(b ginkgo.Benchmarker) {
ginkgo.It("takes less than 15 minutes", func() {
// Measured over multiple samples, scaling takes 10 +/- 2 minutes, so 15 minutes should be fully sufficient.
const timeToWait = 15 * time.Minute

Expand Down Expand Up @@ -111,10 +115,10 @@ var _ = SIGDescribe("[Feature:ClusterSizeAutoscalingScaleUp] [Slow] Autoscaling"
resourceConsumer.ConsumeCPU(int(cpuLoad))

// Measure the time it takes for the service to scale to 8 pods with 50% CPU utilization each.
b.Time("total scale-up time", func() {
experiment.SampleDuration("total scale-up time", func(idx int) {
resourceConsumer.WaitForReplicas(8, timeToWait)
})
}, 1) // Increase to run the test more than once.
}, gmeasure.SamplingConfig{N: 1})
}) // Increase to run the test more than once.
})
})
})
202 changes: 202 additions & 0 deletions vendor/github.com/onsi/gomega/gmeasure/cache.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions vendor/github.com/onsi/gomega/gmeasure/enum_support.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.