Skip to content

Commit 3b51ac1

Browse files
committed
linter fixes
1 parent 843ba6f commit 3b51ac1

File tree

7 files changed

+19
-22
lines changed

7 files changed

+19
-22
lines changed

controllers/vspherecluster_reconciler.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,7 @@ func (r *clusterReconciler) controlPlaneMachineToCluster(ctx context.Context, o
567567
}
568568

569569
return []ctrl.Request{{
570-
NamespacedName: types.NamespacedName{
571-
Namespace: vsphereClusterKey.Namespace,
572-
Name: vsphereClusterKey.Name,
573-
},
570+
NamespacedName: types.NamespacedName(vsphereClusterKey),
574571
}}
575572
}
576573

controllers/vspherecluster_reconciler_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() {
119119
// Make sure the VSphereCluster exists.
120120
Eventually(func() error {
121121
return testEnv.Get(ctx, key, instance)
122-
}, timeout).Should(BeNil())
122+
}, timeout).Should(Succeed())
123123

124124
By("setting the OwnerRef on the VSphereCluster")
125125
Eventually(func() error {
@@ -132,7 +132,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() {
132132
UID: "blah",
133133
})
134134
return ph.Patch(ctx, instance, patch.WithStatusObservedGeneration{})
135-
}, timeout).Should(BeNil())
135+
}, timeout).Should(Succeed())
136136

137137
Eventually(func() bool {
138138
if err := testEnv.Get(ctx, key, instance); err != nil {
@@ -432,7 +432,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() {
432432
Expect(err).ShouldNot(HaveOccurred())
433433
zoneOne.Status.Ready = ptr.To(true)
434434
return ph.Patch(ctx, zoneOne, patch.WithStatusObservedGeneration{})
435-
}, timeout).Should(BeNil())
435+
}, timeout).Should(Succeed())
436436

437437
Eventually(func() bool {
438438
if err := testEnv.Get(ctx, key, instance); err != nil {
@@ -451,7 +451,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() {
451451
Expect(err).ShouldNot(HaveOccurred())
452452
zoneOne.Status.Ready = ptr.To(true)
453453
return ph.Patch(ctx, zoneOne, patch.WithStatusObservedGeneration{})
454-
}, timeout).Should(BeNil())
454+
}, timeout).Should(Succeed())
455455
})
456456

457457
It("should remove the FailureDomainsAvailable condition from the cluster", func() {

controllers/vspheremachine_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ var _ = Describe("VsphereMachineReconciler", func() {
166166
Expect(err).ShouldNot(HaveOccurred())
167167
capiCluster.Status.InfrastructureReady = true
168168
return ph.Patch(ctx, capiCluster, patch.WithStatusObservedGeneration{})
169-
}, timeout).Should(BeNil())
169+
}, timeout).Should(Succeed())
170170

171171
Eventually(func() bool {
172172
return isPresentAndFalseWithReason(infraMachine, infrav1.VMProvisionedCondition, infrav1.WaitingForClusterInfrastructureReason)
@@ -199,7 +199,7 @@ var _ = Describe("VsphereMachineReconciler", func() {
199199
DataSecretName: ptr.To("some-secret"),
200200
}
201201
return ph.Patch(ctx, capiMachine, patch.WithStatusObservedGeneration{})
202-
}, timeout).Should(BeNil())
202+
}, timeout).Should(Succeed())
203203

204204
Eventually(func() int {
205205
vms := infrav1.VSphereVMList{}

pkg/services/govmomi/ipam/status_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func Test_buildIPAMDeviceConfigs(t *testing.T) {
218218
// The IPAddressClaimed condition should not be added
219219
config, err := buildIPAMDeviceConfigs(ctx, vmCtx, networkStatus)
220220
g.Expect(err).NotTo(gomega.HaveOccurred())
221-
g.Expect(config[0].IPAMAddresses).To(gomega.HaveLen(0))
221+
g.Expect(config[0].IPAMAddresses).To(gomega.BeEmpty())
222222
})
223223
}
224224

@@ -435,7 +435,7 @@ func Test_BuildState(t *testing.T) {
435435

436436
state, err := BuildState(ctx, vmCtx, networkStatus)
437437
g.Expect(err).NotTo(gomega.HaveOccurred())
438-
g.Expect(state).To(gomega.HaveLen(0))
438+
g.Expect(state).To(gomega.BeEmpty())
439439
})
440440

441441
t.Run("when one device has no pool and is DHCP true, and one device has a IPAddressPool", func(_ *testing.T) {

test/e2e/multivc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ func VerifyMultiVC(ctx context.Context, input MultiVCenterSpecInput) {
138138
Consistently(func() error {
139139
kubeSystem := &corev1.Namespace{}
140140
return input.Global.BootstrapClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
141-
}, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability")
141+
}, "5s", "100ms").Should(Succeed(), "Failed to assert bootstrap API server stability")
142142
Consistently(func() error {
143143
kubeSystem := &corev1.Namespace{}
144144
return mgmtClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
145-
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")
145+
}, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability")
146146

147147
// Get the machines of the workloadCluster before it is moved to become self-hosted to make sure that the move did not trigger
148148
// any unexpected rollouts.

test/e2e/scale_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ var _ = Describe("When testing the machinery for scale testing using vcsim provi
123123
addVCSimTestVariables(clusterProxy, fmt.Sprintf("scale-%s", clusterName), testSpecificIPAddressClaims, testSpecificVariables, false)
124124
}
125125

126-
clusterTemplateYAML = bytes.Replace(clusterTemplateYAML, []byte(scaleClusterControlPlaneEndpointIPPlaceholder), []byte(testSpecificVariables["CONTROL_PLANE_ENDPOINT_IP"]), -1)
127-
clusterTemplateYAML = bytes.Replace(clusterTemplateYAML, []byte(scaleClusterControlPlaneEndpointPortPlaceholder), []byte(testSpecificVariables["CONTROL_PLANE_ENDPOINT_PORT"]), -1)
128-
clusterTemplateYAML = bytes.Replace(clusterTemplateYAML, []byte(scaleClusterVSphereServerPlaceholder), []byte(testSpecificVariables["VSPHERE_SERVER"]), -1)
129-
clusterTemplateYAML = bytes.Replace(clusterTemplateYAML, []byte(scaleClusterVSphereTLSThumbprintPlaceholder), []byte(testSpecificVariables["VSPHERE_TLS_THUMBPRINT"]), -1)
126+
clusterTemplateYAML = bytes.ReplaceAll(clusterTemplateYAML, []byte(scaleClusterControlPlaneEndpointIPPlaceholder), []byte(testSpecificVariables["CONTROL_PLANE_ENDPOINT_IP"]))
127+
clusterTemplateYAML = bytes.ReplaceAll(clusterTemplateYAML, []byte(scaleClusterControlPlaneEndpointPortPlaceholder), []byte(testSpecificVariables["CONTROL_PLANE_ENDPOINT_PORT"]))
128+
clusterTemplateYAML = bytes.ReplaceAll(clusterTemplateYAML, []byte(scaleClusterVSphereServerPlaceholder), []byte(testSpecificVariables["VSPHERE_SERVER"]))
129+
clusterTemplateYAML = bytes.ReplaceAll(clusterTemplateYAML, []byte(scaleClusterVSphereTLSThumbprintPlaceholder), []byte(testSpecificVariables["VSPHERE_TLS_THUMBPRINT"]))
130130

131131
if testMode == GovmomiTestMode {
132-
clusterClassYAML = bytes.Replace(clusterClassYAML, []byte(scaleClusterNamePlaceholder), []byte(clusterName), -1)
133-
clusterClassYAML = bytes.Replace(clusterClassYAML, []byte(scaleClusterVSphereServerPlaceholder), []byte(testSpecificVariables["VSPHERE_SERVER"]), -1)
134-
clusterClassYAML = bytes.Replace(clusterClassYAML, []byte(scaleClusterVSphereTLSThumbprintPlaceholder), []byte(testSpecificVariables["VSPHERE_TLS_THUMBPRINT"]), -1)
132+
clusterClassYAML = bytes.ReplaceAll(clusterClassYAML, []byte(scaleClusterNamePlaceholder), []byte(clusterName))
133+
clusterClassYAML = bytes.ReplaceAll(clusterClassYAML, []byte(scaleClusterVSphereServerPlaceholder), []byte(testSpecificVariables["VSPHERE_SERVER"]))
134+
clusterClassYAML = bytes.ReplaceAll(clusterClassYAML, []byte(scaleClusterVSphereTLSThumbprintPlaceholder), []byte(testSpecificVariables["VSPHERE_TLS_THUMBPRINT"]))
135135
}
136136

137137
return clusterClassYAML, clusterTemplateYAML

test/framework/ip/vcsim.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (h *vcsim) ClaimIPs(ctx context.Context, opts ...ClaimOption) (AddressClaim
8888
// might be we want to shift to a better error management here, but for now this should be enough to point in the right direction
8989
panic(fmt.Sprintf("unable to claim vcsim controlPlaneEndpoint for variable name %s. variable name must end with _IP", variables))
9090
}
91-
variables[strings.Replace(variable, "_IP", "_PORT", -1)] = port
91+
variables[strings.ReplaceAll(variable, "_IP", "_PORT")] = port
9292
}
9393
}
9494

0 commit comments

Comments
 (0)