Skip to content

Commit 8c4bfac

Browse files
authored
Merge pull request #11740 from JoelSpeed/update-golangci-lint
🌱 Update golangci-lint to v1.63.4
2 parents 1089feb + 645f29b commit 8c4bfac

File tree

10 files changed

+42
-19
lines changed

10 files changed

+42
-19
lines changed

.github/workflows/pr-golangci-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ jobs:
3030
- name: golangci-lint
3131
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # tag=v6.2.0
3232
with:
33-
version: v1.60.2
33+
version: v1.63.4
3434
args: --out-format=colored-line-number
3535
working-directory: ${{matrix.working-directory}}

controlplane/kubeadm/internal/workload_cluster_coredns_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ func TestUpdateCoreDNS(t *testing.T) {
552552
return errors.New("the coredns ConfigMap does not have the Corefile-backup entry or this it has an unexpected value")
553553
}
554554
return nil
555-
}, "5s").Should(BeNil())
555+
}, "5s").Should(Succeed())
556556

557557
// assert CoreDNS deployment
558558
var actualDeployment appsv1.Deployment

exp/internal/controllers/machinepool_controller_phases.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ func (r *MachinePoolReconciler) waitForMachineCreation(ctx context.Context, mach
533533
// The polling is against a local memory cache.
534534
const waitForCacheUpdateInterval = 100 * time.Millisecond
535535

536-
for i := range len(machineList) {
536+
for i := range machineList {
537537
machine := machineList[i]
538538
pollErr := wait.PollUntilContextTimeout(ctx, waitForCacheUpdateInterval, waitForCacheUpdateTimeout, true, func(ctx context.Context) (bool, error) {
539539
key := client.ObjectKey{Namespace: machine.Namespace, Name: machine.Name}

exp/runtime/internal/controllers/extensionconfig_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func TestExtensionReconciler_Reconcile(t *testing.T) {
157157
return errors.Errorf("URL not set on updated object: got: %s, want: %s", *conf.Spec.ClientConfig.URL, updatedServer.URL)
158158
}
159159
return nil
160-
}, 30*time.Second, 100*time.Millisecond).Should(BeNil())
160+
}, 30*time.Second, 100*time.Millisecond).Should(Succeed())
161161

162162
// Reconcile the extension and assert discovery has succeeded.
163163
_, err = r.Reconcile(ctx, ctrl.Request{NamespacedName: util.ObjectKey(extensionConfig)})

exp/topology/desiredstate/desired_state_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,13 @@ func TestComputeControlPlaneVersion(t *testing.T) {
12051205
}
12061206

12071207
_, err := r.computeControlPlaneVersion(ctx, tt.s)
1208-
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneUpgrade) == 1).To(Equal(tt.wantHookToBeCalled))
1208+
1209+
if tt.wantHookToBeCalled {
1210+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneUpgrade)).To(Equal(1), "Expected hook to be called once")
1211+
} else {
1212+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneUpgrade)).To(Equal(0), "Did not expect hook to be called")
1213+
}
1214+
12091215
g.Expect(hooks.IsPending(runtimehooksv1.AfterControlPlaneUpgrade, tt.s.Current.Cluster)).To(Equal(tt.wantIntentToCall))
12101216
g.Expect(err != nil).To(Equal(tt.wantErr))
12111217
if tt.wantHookToBeCalled && !tt.wantErr {

internal/controllers/machineset/machineset_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ func (r *Reconciler) adoptOrphan(ctx context.Context, machineSet *clusterv1.Mach
10221022
func (r *Reconciler) waitForMachineCreation(ctx context.Context, machineList []*clusterv1.Machine) error {
10231023
log := ctrl.LoggerFrom(ctx)
10241024

1025-
for i := range len(machineList) {
1025+
for i := range machineList {
10261026
machine := machineList[i]
10271027
pollErr := wait.PollUntilContextTimeout(ctx, stateConfirmationInterval, stateConfirmationTimeout, true, func(ctx context.Context) (bool, error) {
10281028
key := client.ObjectKey{Namespace: machine.Namespace, Name: machine.Name}
@@ -1048,7 +1048,7 @@ func (r *Reconciler) waitForMachineCreation(ctx context.Context, machineList []*
10481048
func (r *Reconciler) waitForMachineDeletion(ctx context.Context, machineList []*clusterv1.Machine) error {
10491049
log := ctrl.LoggerFrom(ctx)
10501050

1051-
for i := range len(machineList) {
1051+
for i := range machineList {
10521052
machine := machineList[i]
10531053
pollErr := wait.PollUntilContextTimeout(ctx, stateConfirmationInterval, stateConfirmationTimeout, true, func(ctx context.Context) (bool, error) {
10541054
m := &clusterv1.Machine{}

internal/controllers/topology/cluster/cluster_controller_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,12 @@ func TestClusterReconciler_reconcileDelete(t *testing.T) {
578578
g.Expect(err).ToNot(HaveOccurred())
579579
g.Expect(res).To(BeComparableTo(tt.wantResult))
580580
g.Expect(hooks.IsOkToDelete(tt.cluster)).To(Equal(tt.wantOkToDelete))
581-
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.BeforeClusterDelete) == 1).To(Equal(tt.wantHookToBeCalled))
581+
582+
if tt.wantHookToBeCalled {
583+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.BeforeClusterDelete)).To(Equal(1), "Expected hook to be called once")
584+
} else {
585+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.BeforeClusterDelete)).To(Equal(0), "Did not expect hook to be called")
586+
}
582587
}
583588
})
584589
}

internal/controllers/topology/cluster/reconcile_state_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,13 @@ func TestReconcile_callAfterControlPlaneInitialized(t *testing.T) {
471471
}
472472

473473
err := r.callAfterControlPlaneInitialized(ctx, s)
474-
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneInitialized) == 1).To(Equal(tt.wantHookToBeCalled))
474+
475+
if tt.wantHookToBeCalled {
476+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneInitialized)).To(Equal(1), "Expected hook to be called once")
477+
} else {
478+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneInitialized)).To(Equal(0), "Did not expect hook to be called")
479+
}
480+
475481
g.Expect(hooks.IsPending(runtimehooksv1.AfterControlPlaneInitialized, tt.cluster)).To(Equal(tt.wantMarked))
476482
g.Expect(err != nil).To(Equal(tt.wantError))
477483
})
@@ -1089,7 +1095,13 @@ func TestReconcile_callAfterClusterUpgrade(t *testing.T) {
10891095
}
10901096

10911097
err := r.callAfterClusterUpgrade(ctx, tt.s)
1092-
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterClusterUpgrade) == 1).To(Equal(tt.wantHookToBeCalled))
1098+
1099+
if tt.wantHookToBeCalled {
1100+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterClusterUpgrade)).To(Equal(1), "Expected hook to be called once")
1101+
} else {
1102+
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterClusterUpgrade)).To(Equal(0), "Did not expect hook to be called")
1103+
}
1104+
10931105
g.Expect(hooks.IsPending(runtimehooksv1.AfterClusterUpgrade, tt.s.Current.Cluster)).To(Equal(tt.wantMarked))
10941106
g.Expect(err != nil).To(Equal(tt.wantError))
10951107
})

test/e2e/clusterclass_changes.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func modifyControlPlaneViaClusterClassAndWait(ctx context.Context, input modifyC
301301
g.Expect(currentValue).To(Equal(expectedValue), fmt.Sprintf("field %q should be equal", fieldPath))
302302
}
303303
return nil
304-
}, input.WaitForControlPlane...).Should(BeNil())
304+
}, input.WaitForControlPlane...).Should(Succeed())
305305
}
306306

307307
// assertControlPlaneTopologyFields asserts that all fields set in the ControlPlaneTopology have been set on the ControlPlane.
@@ -454,7 +454,7 @@ func modifyMachineDeploymentViaClusterClassAndWait(ctx context.Context, input mo
454454
g.Expect(currentValue).To(Equal(expectedValue), fmt.Sprintf("field %q should be equal", fieldPath))
455455
}
456456
return nil
457-
}, input.WaitForMachineDeployments...).Should(BeNil())
457+
}, input.WaitForMachineDeployments...).Should(Succeed())
458458
}
459459
}
460460
}
@@ -580,7 +580,7 @@ func modifyMachinePoolViaClusterClassAndWait(ctx context.Context, input modifyMa
580580
g.Expect(currentValue).To(Equal(expectedValue), fmt.Sprintf("field %q should be equal", fieldPath))
581581
}
582582
return nil
583-
}, input.WaitForMachinePools...).Should(BeNil())
583+
}, input.WaitForMachinePools...).Should(Succeed())
584584
}
585585
}
586586
}
@@ -735,7 +735,7 @@ func rebaseClusterClassAndWait(ctx context.Context, input rebaseClusterClassAndW
735735
}
736736

737737
return nil
738-
}, input.WaitForMachineDeployments...).Should(BeNil())
738+
}, input.WaitForMachineDeployments...).Should(Succeed())
739739
}
740740

741741
// Verify that the ControlPlane has not been changed.
@@ -783,5 +783,5 @@ func deleteMachineDeploymentTopologyAndWait(ctx context.Context, input deleteMac
783783
return errors.Errorf("expected no MachineDeployment for topology %q, but got %d", mdTopologyToDelete.Name, len(mdList.Items))
784784
}
785785
return nil
786-
}, input.WaitForMachineDeployments...).Should(BeNil())
786+
}, input.WaitForMachineDeployments...).Should(Succeed())
787787
}

test/e2e/self_hosted.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
236236
Consistently(func() error {
237237
kubeSystem := &corev1.Namespace{}
238238
return input.BootstrapClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
239-
}, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability")
239+
}, "5s", "100ms").Should(Succeed(), "Failed to assert bootstrap API server stability")
240240
Consistently(func() error {
241241
kubeSystem := &corev1.Namespace{}
242242
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
243-
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")
243+
}, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability")
244244

245245
// Get the machines of the workloadCluster before it is moved to become self-hosted to make sure that the move did not trigger
246246
// any unexpected rollouts.
@@ -438,11 +438,11 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
438438
Consistently(func() error {
439439
kubeSystem := &corev1.Namespace{}
440440
return input.BootstrapClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
441-
}, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability")
441+
}, "5s", "100ms").Should(Succeed(), "Failed to assert bootstrap API server stability")
442442
Consistently(func() error {
443443
kubeSystem := &corev1.Namespace{}
444444
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
445-
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")
445+
}, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability")
446446

447447
By("Moving the cluster back to bootstrap")
448448
clusterctl.Move(ctx, clusterctl.MoveInput{

0 commit comments

Comments
 (0)