Skip to content

Commit 043509c

Browse files
authored
Merge pull request #11743 from sbueringer/pr-extend-scale-test-follow-up
🌱 test/framework: Rename GetVariable functions
2 parents 9a5f427 + cabafc3 commit 043509c

24 files changed

+79
-79
lines changed

test/e2e/autoscaler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func AutoscalerSpec(ctx context.Context, inputGetter func() AutoscalerSpecInput)
136136
Flavor: flavor,
137137
Namespace: namespace.Name,
138138
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
139-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
139+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersion),
140140
ControlPlaneMachineCount: ptr.To[int64](1),
141141
WorkerMachineCount: nil,
142142
},
@@ -180,7 +180,7 @@ func AutoscalerSpec(ctx context.Context, inputGetter func() AutoscalerSpecInput)
180180
}
181181

182182
By("Installing the autoscaler on the workload cluster")
183-
autoscalerWorkloadYAMLPath := input.E2EConfig.GetVariable(AutoscalerWorkloadYAMLPath)
183+
autoscalerWorkloadYAMLPath := input.E2EConfig.MustGetVariable(AutoscalerWorkloadYAMLPath)
184184
framework.ApplyAutoscalerToWorkloadCluster(ctx, framework.ApplyAutoscalerToWorkloadClusterInput{
185185
ArtifactFolder: input.ArtifactFolder,
186186
InfrastructureMachineTemplateKind: input.InfrastructureMachineTemplateKind,

test/e2e/cluster_deletion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func ClusterDeletionSpec(ctx context.Context, inputGetter func() ClusterDeletion
183183
Flavor: flavor,
184184
Namespace: namespace.Name,
185185
ClusterName: clusterName,
186-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
186+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersion),
187187
ControlPlaneMachineCount: controlPlaneMachineCount,
188188
WorkerMachineCount: workerMachineCount,
189189
},

test/e2e/cluster_upgrade.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
113113
Expect(input.E2EConfig.Variables).To(HaveKey(KubernetesVersionUpgradeTo))
114114

115115
Expect(input.E2EConfig.Variables).To(HaveKey(kubetestConfigurationVariable), "% spec requires a %s variable to be defined in the config file", specName, kubetestConfigurationVariable)
116-
kubetestConfigFilePath = input.E2EConfig.GetVariable(kubetestConfigurationVariable)
116+
kubetestConfigFilePath = input.E2EConfig.MustGetVariable(kubetestConfigurationVariable)
117117
Expect(kubetestConfigFilePath).To(BeAnExistingFile(), "%s should be a valid kubetest config file")
118118

119119
if input.ControlPlaneMachineCount == nil {
@@ -129,10 +129,10 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
129129
}
130130

131131
if input.E2EConfig.HasVariable(EtcdVersionUpgradeTo) {
132-
etcdVersionUpgradeTo = input.E2EConfig.GetVariable(EtcdVersionUpgradeTo)
132+
etcdVersionUpgradeTo = input.E2EConfig.MustGetVariable(EtcdVersionUpgradeTo)
133133
}
134134
if input.E2EConfig.HasVariable(CoreDNSVersionUpgradeTo) {
135-
coreDNSVersionUpgradeTo = input.E2EConfig.GetVariable(CoreDNSVersionUpgradeTo)
135+
coreDNSVersionUpgradeTo = input.E2EConfig.MustGetVariable(CoreDNSVersionUpgradeTo)
136136
}
137137

138138
// Setup a Namespace where to host objects for this spec and create a watcher for the Namespace events.
@@ -160,7 +160,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
160160
Flavor: ptr.Deref(input.Flavor, "upgrades"),
161161
Namespace: namespace.Name,
162162
ClusterName: clusterName,
163-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeFrom),
163+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeFrom),
164164
ControlPlaneMachineCount: ptr.To[int64](controlPlaneMachineCount),
165165
WorkerMachineCount: ptr.To[int64](workerMachineCount),
166166
},
@@ -182,7 +182,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
182182
DNSImageTag: coreDNSVersionUpgradeTo,
183183
MachineDeployments: clusterResources.MachineDeployments,
184184
MachinePools: clusterResources.MachinePools,
185-
KubernetesUpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
185+
KubernetesUpgradeVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
186186
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
187187
WaitForMachinePoolToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-pool-upgrade"),
188188
WaitForKubeProxyUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
@@ -203,11 +203,11 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
203203
)
204204

205205
if input.E2EConfig.HasVariable(CPMachineTemplateUpgradeTo) {
206-
upgradeCPMachineTemplateTo = ptr.To(input.E2EConfig.GetVariable(CPMachineTemplateUpgradeTo))
206+
upgradeCPMachineTemplateTo = ptr.To(input.E2EConfig.MustGetVariable(CPMachineTemplateUpgradeTo))
207207
}
208208

209209
if input.E2EConfig.HasVariable(WorkersMachineTemplateUpgradeTo) {
210-
upgradeWorkersMachineTemplateTo = ptr.To(input.E2EConfig.GetVariable(WorkersMachineTemplateUpgradeTo))
210+
upgradeWorkersMachineTemplateTo = ptr.To(input.E2EConfig.MustGetVariable(WorkersMachineTemplateUpgradeTo))
211211
}
212212

213213
framework.UpgradeControlPlaneAndWaitForUpgrade(ctx, framework.UpgradeControlPlaneAndWaitForUpgradeInput{
@@ -216,7 +216,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
216216
ControlPlane: clusterResources.ControlPlane,
217217
EtcdImageTag: etcdVersionUpgradeTo,
218218
DNSImageTag: coreDNSVersionUpgradeTo,
219-
KubernetesUpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
219+
KubernetesUpgradeVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
220220
UpgradeMachineTemplate: upgradeCPMachineTemplateTo,
221221
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
222222
WaitForKubeProxyUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
@@ -234,7 +234,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
234234
framework.UpgradeMachineDeploymentsAndWait(ctx, framework.UpgradeMachineDeploymentsAndWaitInput{
235235
ClusterProxy: input.BootstrapClusterProxy,
236236
Cluster: clusterResources.Cluster,
237-
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
237+
UpgradeVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
238238
UpgradeMachineTemplate: upgradeWorkersMachineTemplateTo,
239239
MachineDeployments: clusterResources.MachineDeployments,
240240
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),
@@ -245,7 +245,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
245245
framework.UpgradeMachinePoolAndWait(ctx, framework.UpgradeMachinePoolAndWaitInput{
246246
ClusterProxy: input.BootstrapClusterProxy,
247247
Cluster: clusterResources.Cluster,
248-
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
248+
UpgradeVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
249249
WaitForMachinePoolToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-pool-upgrade"),
250250
MachinePools: clusterResources.MachinePools,
251251
})
@@ -258,7 +258,7 @@ func ClusterUpgradeConformanceSpec(ctx context.Context, inputGetter func() Clust
258258
workloadClient := workloadProxy.GetClient()
259259
framework.WaitForNodesReady(ctx, framework.WaitForNodesReadyInput{
260260
Lister: workloadClient,
261-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
261+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
262262
Count: int(clusterResources.ExpectedTotalNodes()),
263263
WaitForNodesReady: input.E2EConfig.GetIntervals(specName, "wait-nodes-ready"),
264264
})

test/e2e/cluster_upgrade_runtimesdk.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
220220
Flavor: ptr.Deref(input.Flavor, "upgrades"),
221221
Namespace: namespace.Name,
222222
ClusterName: clusterName,
223-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeFrom),
223+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeFrom),
224224
ControlPlaneMachineCount: ptr.To[int64](controlPlaneMachineCount),
225225
WorkerMachineCount: ptr.To[int64](workerMachineCount),
226226
ClusterctlVariables: variables,
@@ -271,7 +271,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
271271
ControlPlane: clusterResources.ControlPlane,
272272
MachineDeployments: clusterResources.MachineDeployments,
273273
MachinePools: clusterResources.MachinePools,
274-
KubernetesUpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
274+
KubernetesUpgradeVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
275275
WaitForMachinesToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
276276
WaitForMachinePoolToBeUpgraded: input.E2EConfig.GetIntervals(specName, "wait-machine-pool-upgrade"),
277277
WaitForKubeProxyUpgrade: input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"),
@@ -281,7 +281,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
281281
beforeClusterUpgradeTestHandler(ctx,
282282
input.BootstrapClusterProxy.GetClient(),
283283
clusterRef,
284-
input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
284+
input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
285285
input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"))
286286
},
287287
PreWaitForWorkersToBeUpgraded: func() {
@@ -292,7 +292,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
292292
afterControlPlaneUpgradeTestHandler(ctx,
293293
input.BootstrapClusterProxy.GetClient(),
294294
clusterRef,
295-
input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
295+
input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
296296
input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade"))
297297
},
298298
})
@@ -302,7 +302,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
302302
workloadClient := workloadProxy.GetClient()
303303
framework.WaitForNodesReady(ctx, framework.WaitForNodesReadyInput{
304304
Lister: workloadClient,
305-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
305+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersionUpgradeTo),
306306
Count: int(clusterResources.ExpectedTotalNodes()),
307307
WaitForNodesReady: input.E2EConfig.GetIntervals(specName, "wait-nodes-ready"),
308308
})

test/e2e/cluster_upgrade_runtimesdk_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
var _ = Describe("When upgrading a workload cluster using ClusterClass with RuntimeSDK [ClusterClass]", Label("ClusterClass"), func() {
3333
ClusterUpgradeWithRuntimeSDKSpec(ctx, func() ClusterUpgradeWithRuntimeSDKSpecInput {
34-
version, err := semver.ParseTolerant(e2eConfig.GetVariable(KubernetesVersionUpgradeFrom))
34+
version, err := semver.ParseTolerant(e2eConfig.MustGetVariable(KubernetesVersionUpgradeFrom))
3535
Expect(err).ToNot(HaveOccurred(), "Invalid argument, KUBERNETES_VERSION_UPGRADE_FROM is not a valid version")
3636
if version.LT(semver.MustParse("1.24.0")) {
3737
Fail("This test only supports upgrades from Kubernetes >= v1.24.0")

test/e2e/clusterclass_changes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func ClusterClassChangesSpec(ctx context.Context, inputGetter func() ClusterClas
150150
Expect(input.BootstrapClusterProxy).ToNot(BeNil(), "Invalid argument. input.BootstrapClusterProxy can't be nil when calling %s spec", specName)
151151
Expect(os.MkdirAll(input.ArtifactFolder, 0750)).To(Succeed(), "Invalid argument. input.ArtifactFolder can't be created for %s spec", specName)
152152
Expect(input.E2EConfig.Variables).To(HaveKey(KubernetesVersion))
153-
Expect(input.E2EConfig.Variables).To(HaveValidVersion(input.E2EConfig.GetVariable(KubernetesVersion)))
153+
Expect(input.E2EConfig.Variables).To(HaveValidVersion(input.E2EConfig.MustGetVariable(KubernetesVersion)))
154154
Expect(input.ModifyControlPlaneFields).ToNot(BeEmpty(), "Invalid argument. input.ModifyControlPlaneFields can't be empty when calling %s spec", specName)
155155

156156
// Set up a Namespace where to host objects for this spec and create a watcher for the namespace events.
@@ -176,7 +176,7 @@ func ClusterClassChangesSpec(ctx context.Context, inputGetter func() ClusterClas
176176
Flavor: input.Flavor,
177177
Namespace: namespace.Name,
178178
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
179-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
179+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersion),
180180
ControlPlaneMachineCount: ptr.To[int64](1),
181181
WorkerMachineCount: ptr.To[int64](1),
182182
},

test/e2e/clusterclass_rollout.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func ClusterClassRolloutSpec(ctx context.Context, inputGetter func() ClusterClas
115115
Expect(input.BootstrapClusterProxy).ToNot(BeNil(), "Invalid argument. input.BootstrapClusterProxy can't be nil when calling %s spec", specName)
116116
Expect(os.MkdirAll(input.ArtifactFolder, 0750)).To(Succeed(), "Invalid argument. input.ArtifactFolder can't be created for %s spec", specName)
117117
Expect(input.E2EConfig.Variables).To(HaveKey(KubernetesVersion))
118-
Expect(input.E2EConfig.Variables).To(HaveValidVersion(input.E2EConfig.GetVariable(KubernetesVersion)))
118+
Expect(input.E2EConfig.Variables).To(HaveValidVersion(input.E2EConfig.MustGetVariable(KubernetesVersion)))
119119

120120
// Set a default function to ensure that FilterMetadataBeforeValidation has a default behavior for
121121
// filtering metadata if it is not specified by infrastructure provider.
@@ -146,7 +146,7 @@ func ClusterClassRolloutSpec(ctx context.Context, inputGetter func() ClusterClas
146146
Flavor: input.Flavor,
147147
Namespace: namespace.Name,
148148
ClusterName: fmt.Sprintf("%s-%s", specName, util.RandomString(6)),
149-
KubernetesVersion: input.E2EConfig.GetVariable(KubernetesVersion),
149+
KubernetesVersion: input.E2EConfig.MustGetVariable(KubernetesVersion),
150150
ControlPlaneMachineCount: ptr.To[int64](1),
151151
WorkerMachineCount: ptr.To[int64](1),
152152
},

test/e2e/clusterctl_upgrade.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
273273
RequiresDockerSock: input.E2EConfig.HasDockerProvider(),
274274
// Note: most of this images won't be used while starting the controllers, because it is used to spin up older versions of CAPI. Those images will be eventually used when upgrading to current.
275275
Images: input.E2EConfig.Images,
276-
IPFamily: input.E2EConfig.GetVariable(IPFamily),
276+
IPFamily: input.E2EConfig.MustGetVariable(IPFamily),
277277
LogFolder: filepath.Join(managementClusterLogFolder, "logs-kind"),
278278
})
279279
Expect(managementClusterProvider).ToNot(BeNil(), "Failed to create a kind cluster")
@@ -416,7 +416,7 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
416416
workloadClusterNamespace := testNamespace.Name
417417
kubernetesVersion := input.WorkloadKubernetesVersion
418418
if kubernetesVersion == "" {
419-
kubernetesVersion = input.E2EConfig.GetVariable(KubernetesVersion)
419+
kubernetesVersion = input.E2EConfig.MustGetVariable(KubernetesVersion)
420420
}
421421
controlPlaneMachineCount := ptr.To[int64](1)
422422
if input.ControlPlaneMachineCount != nil {

test/e2e/clusterctl_upgrade_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.9=>cur
249249
stableRelease, err := GetStableReleaseOfMinor(ctx, version)
250250
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for minor release : %s", version)
251251
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
252-
initKubernetesVersion, err := kubernetesversions.ResolveVersion(ctx, e2eConfig.GetVariable("KUBERNETES_VERSION_LATEST_CI"))
252+
initKubernetesVersion, err := kubernetesversions.ResolveVersion(ctx, e2eConfig.MustGetVariable("KUBERNETES_VERSION_LATEST_CI"))
253253
Expect(err).ToNot(HaveOccurred())
254254
return ClusterctlUpgradeSpecInput{
255255
E2EConfig: e2eConfig,

test/e2e/e2e_suite_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol
220220

221221
// Ensuring a CNI file is defined in the config and register a FileTransformation to inject the referenced file in place of the CNI_RESOURCES envSubst variable.
222222
Expect(config.Variables).To(HaveKey(CNIPath), "Missing %s variable in the config", CNIPath)
223-
cniPath := config.GetVariable(CNIPath)
223+
cniPath := config.MustGetVariable(CNIPath)
224224
Expect(cniPath).To(BeAnExistingFile(), "The %s variable should resolve to an existing file", CNIPath)
225225

226226
createRepositoryInput.RegisterClusterResourceSetConfigMapTransformation(cniPath, CNIResources)
@@ -237,10 +237,10 @@ func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme,
237237
By("Creating the bootstrap cluster")
238238
clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(ctx, bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{
239239
Name: config.ManagementClusterName,
240-
KubernetesVersion: config.GetVariable(KubernetesVersionManagement),
240+
KubernetesVersion: config.MustGetVariable(KubernetesVersionManagement),
241241
RequiresDockerSock: config.HasDockerProvider(),
242242
Images: config.Images,
243-
IPFamily: config.GetVariable(IPFamily),
243+
IPFamily: config.MustGetVariable(IPFamily),
244244
LogFolder: filepath.Join(artifactFolder, "kind"),
245245
})
246246
Expect(clusterProvider).ToNot(BeNil(), "Failed to create a bootstrap cluster")

0 commit comments

Comments
 (0)