Skip to content

Commit ad5bc13

Browse files
Update to use gomegae gmeasure (#217)
1 parent c83e66e commit ad5bc13

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

test/e2e/conformance_test.go

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929

3030
. "github.com/onsi/ginkgo/v2"
3131
. "github.com/onsi/gomega"
32+
"github.com/onsi/gomega/gmeasure"
3233
corev1 "k8s.io/api/core/v1"
3334
"k8s.io/apimachinery/pkg/types"
3435
"k8s.io/utils/pointer"
@@ -71,8 +72,10 @@ var _ = Describe("Conformance Tests", func() {
7172
result = new(clusterctl.ApplyClusterTemplateAndWaitResult)
7273

7374
})
75+
It(specName, func() {
76+
experiment := gmeasure.NewExperiment(specName)
77+
AddReportEntry(experiment.Name, experiment)
7478

75-
Measure(specName, func(b Benchmarker) {
7679
var err error
7780

7881
kubernetesVersion := e2eConfig.GetVariable(capi_e2e.KubernetesVersion)
@@ -82,42 +85,41 @@ var _ = Describe("Conformance Tests", func() {
8285
controlPlaneMachineCount, err := strconv.ParseInt(e2eConfig.GetVariable("CONFORMANCE_CONTROL_PLANE_MACHINE_COUNT"), 10, 64)
8386
Expect(err).NotTo(HaveOccurred())
8487

85-
runtime := b.Time("cluster creation", func() {
86-
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
87-
ClusterProxy: bootstrapClusterProxy,
88-
ConfigCluster: clusterctl.ConfigClusterInput{
89-
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
90-
ClusterctlConfigPath: clusterctlConfigPath,
91-
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
92-
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
93-
Flavor: flavor,
94-
Namespace: namespace.Name,
95-
ClusterName: clusterName,
96-
KubernetesVersion: kubernetesVersion,
97-
ControlPlaneMachineCount: pointer.Int64Ptr(controlPlaneMachineCount),
98-
WorkerMachineCount: pointer.Int64Ptr(workerMachineCount),
99-
},
100-
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
101-
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"),
102-
WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes"),
103-
}, result)
104-
})
105-
106-
b.RecordValue("cluster creation", runtime.Seconds())
88+
stopwatch := experiment.NewStopwatch()
89+
90+
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
91+
ClusterProxy: bootstrapClusterProxy,
92+
ConfigCluster: clusterctl.ConfigClusterInput{
93+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
94+
ClusterctlConfigPath: clusterctlConfigPath,
95+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
96+
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
97+
Flavor: flavor,
98+
Namespace: namespace.Name,
99+
ClusterName: clusterName,
100+
KubernetesVersion: kubernetesVersion,
101+
ControlPlaneMachineCount: pointer.Int64Ptr(controlPlaneMachineCount),
102+
WorkerMachineCount: pointer.Int64Ptr(workerMachineCount),
103+
},
104+
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster"),
105+
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane"),
106+
WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes"),
107+
}, result)
108+
109+
stopwatch.Record("cluster creation")
107110
workloadProxy := bootstrapClusterProxy.GetWorkloadCluster(ctx, namespace.Name, clusterName)
108111

109-
runtime = b.Time("conformance suite", func() {
110-
err := kubetest.Run(context.Background(),
111-
kubetest.RunInput{
112-
ClusterProxy: workloadProxy,
113-
NumberOfNodes: int(workerMachineCount),
114-
ConfigFilePath: kubetestConfigFilePath,
115-
},
116-
)
117-
Expect(err).NotTo(HaveOccurred())
118-
})
119-
b.RecordValue("conformance suite run time", runtime.Seconds())
120-
}, 1)
112+
stopwatch.Reset()
113+
err = kubetest.Run(context.Background(),
114+
kubetest.RunInput{
115+
ClusterProxy: workloadProxy,
116+
NumberOfNodes: int(workerMachineCount),
117+
ConfigFilePath: kubetestConfigFilePath,
118+
},
119+
)
120+
Expect(err).NotTo(HaveOccurred())
121+
stopwatch.Record("conformance suite")
122+
})
121123

122124
AfterEach(func() {
123125
if result.Cluster == nil {

0 commit comments

Comments
 (0)