Stop using the deprecated Measure method

As what suggested by Ginkgo migration guide, `Measure` node was
deprecated and replaced with `It` node which creates `gmeasure.Experiment`.

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen
2022-07-11 17:20:54 +08:00
parent be53d94595
commit d61adab518
10 changed files with 1797 additions and 4 deletions

View File

@@ -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() {
@@ -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() {
@@ -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
@@ -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.
})
})
})