Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Update golangci-lint to v1.63.4 #11740

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # tag=v6.2.0
with:
version: v1.60.2
version: v1.63.4
args: --out-format=colored-line-number
working-directory: ${{matrix.working-directory}}
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func TestUpdateCoreDNS(t *testing.T) {
return errors.New("the coredns ConfigMap does not have the Corefile-backup entry or this it has an unexpected value")
}
return nil
}, "5s").Should(BeNil())
}, "5s").Should(Succeed())

// assert CoreDNS deployment
var actualDeployment appsv1.Deployment
Expand Down
2 changes: 1 addition & 1 deletion exp/internal/controllers/machinepool_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func (r *MachinePoolReconciler) waitForMachineCreation(ctx context.Context, mach
// The polling is against a local memory cache.
const waitForCacheUpdateInterval = 100 * time.Millisecond

for i := range len(machineList) {
for i := range machineList {
machine := machineList[i]
pollErr := wait.PollUntilContextTimeout(ctx, waitForCacheUpdateInterval, waitForCacheUpdateTimeout, true, func(ctx context.Context) (bool, error) {
key := client.ObjectKey{Namespace: machine.Namespace, Name: machine.Name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestExtensionReconciler_Reconcile(t *testing.T) {
return errors.Errorf("URL not set on updated object: got: %s, want: %s", *conf.Spec.ClientConfig.URL, updatedServer.URL)
}
return nil
}, 30*time.Second, 100*time.Millisecond).Should(BeNil())
}, 30*time.Second, 100*time.Millisecond).Should(Succeed())

// Reconcile the extension and assert discovery has succeeded.
_, err = r.Reconcile(ctx, ctrl.Request{NamespacedName: util.ObjectKey(extensionConfig)})
Expand Down
8 changes: 7 additions & 1 deletion exp/topology/desiredstate/desired_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,13 @@ func TestComputeControlPlaneVersion(t *testing.T) {
}

_, err := r.computeControlPlaneVersion(ctx, tt.s)
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneUpgrade) == 1).To(Equal(tt.wantHookToBeCalled))

if tt.wantHookToBeCalled {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneUpgrade)).To(Equal(1), "Expected hook to be called once")
} else {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneUpgrade)).To(Equal(0), "Did not expect hook to be called")
}

g.Expect(hooks.IsPending(runtimehooksv1.AfterControlPlaneUpgrade, tt.s.Current.Cluster)).To(Equal(tt.wantIntentToCall))
g.Expect(err != nil).To(Equal(tt.wantErr))
if tt.wantHookToBeCalled && !tt.wantErr {
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/machineset/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ func (r *Reconciler) adoptOrphan(ctx context.Context, machineSet *clusterv1.Mach
func (r *Reconciler) waitForMachineCreation(ctx context.Context, machineList []*clusterv1.Machine) error {
log := ctrl.LoggerFrom(ctx)

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

for i := range len(machineList) {
for i := range machineList {
machine := machineList[i]
pollErr := wait.PollUntilContextTimeout(ctx, stateConfirmationInterval, stateConfirmationTimeout, true, func(ctx context.Context) (bool, error) {
m := &clusterv1.Machine{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,12 @@ func TestClusterReconciler_reconcileDelete(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())
g.Expect(res).To(BeComparableTo(tt.wantResult))
g.Expect(hooks.IsOkToDelete(tt.cluster)).To(Equal(tt.wantOkToDelete))
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.BeforeClusterDelete) == 1).To(Equal(tt.wantHookToBeCalled))

if tt.wantHookToBeCalled {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.BeforeClusterDelete)).To(Equal(1), "Expected hook to be called once")
} else {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.BeforeClusterDelete)).To(Equal(0), "Did not expect hook to be called")
}
}
})
}
Expand Down
16 changes: 14 additions & 2 deletions internal/controllers/topology/cluster/reconcile_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,13 @@ func TestReconcile_callAfterControlPlaneInitialized(t *testing.T) {
}

err := r.callAfterControlPlaneInitialized(ctx, s)
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneInitialized) == 1).To(Equal(tt.wantHookToBeCalled))

if tt.wantHookToBeCalled {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneInitialized)).To(Equal(1), "Expected hook to be called once")
} else {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterControlPlaneInitialized)).To(Equal(0), "Did not expect hook to be called")
}

g.Expect(hooks.IsPending(runtimehooksv1.AfterControlPlaneInitialized, tt.cluster)).To(Equal(tt.wantMarked))
g.Expect(err != nil).To(Equal(tt.wantError))
})
Expand Down Expand Up @@ -1089,7 +1095,13 @@ func TestReconcile_callAfterClusterUpgrade(t *testing.T) {
}

err := r.callAfterClusterUpgrade(ctx, tt.s)
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterClusterUpgrade) == 1).To(Equal(tt.wantHookToBeCalled))

if tt.wantHookToBeCalled {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterClusterUpgrade)).To(Equal(1), "Expected hook to be called once")
} else {
g.Expect(fakeRuntimeClient.CallAllCount(runtimehooksv1.AfterClusterUpgrade)).To(Equal(0), "Did not expect hook to be called")
}

g.Expect(hooks.IsPending(runtimehooksv1.AfterClusterUpgrade, tt.s.Current.Cluster)).To(Equal(tt.wantMarked))
g.Expect(err != nil).To(Equal(tt.wantError))
})
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/clusterclass_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func modifyControlPlaneViaClusterClassAndWait(ctx context.Context, input modifyC
g.Expect(currentValue).To(Equal(expectedValue), fmt.Sprintf("field %q should be equal", fieldPath))
}
return nil
}, input.WaitForControlPlane...).Should(BeNil())
}, input.WaitForControlPlane...).Should(Succeed())
}

// assertControlPlaneTopologyFields asserts that all fields set in the ControlPlaneTopology have been set on the ControlPlane.
Expand Down Expand Up @@ -454,7 +454,7 @@ func modifyMachineDeploymentViaClusterClassAndWait(ctx context.Context, input mo
g.Expect(currentValue).To(Equal(expectedValue), fmt.Sprintf("field %q should be equal", fieldPath))
}
return nil
}, input.WaitForMachineDeployments...).Should(BeNil())
}, input.WaitForMachineDeployments...).Should(Succeed())
}
}
}
Expand Down Expand Up @@ -580,7 +580,7 @@ func modifyMachinePoolViaClusterClassAndWait(ctx context.Context, input modifyMa
g.Expect(currentValue).To(Equal(expectedValue), fmt.Sprintf("field %q should be equal", fieldPath))
}
return nil
}, input.WaitForMachinePools...).Should(BeNil())
}, input.WaitForMachinePools...).Should(Succeed())
}
}
}
Expand Down Expand Up @@ -735,7 +735,7 @@ func rebaseClusterClassAndWait(ctx context.Context, input rebaseClusterClassAndW
}

return nil
}, input.WaitForMachineDeployments...).Should(BeNil())
}, input.WaitForMachineDeployments...).Should(Succeed())
}

// Verify that the ControlPlane has not been changed.
Expand Down Expand Up @@ -783,5 +783,5 @@ func deleteMachineDeploymentTopologyAndWait(ctx context.Context, input deleteMac
return errors.Errorf("expected no MachineDeployment for topology %q, but got %d", mdTopologyToDelete.Name, len(mdList.Items))
}
return nil
}, input.WaitForMachineDeployments...).Should(BeNil())
}, input.WaitForMachineDeployments...).Should(Succeed())
}
8 changes: 4 additions & 4 deletions test/e2e/self_hosted.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
Consistently(func() error {
kubeSystem := &corev1.Namespace{}
return input.BootstrapClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
}, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability")
}, "5s", "100ms").Should(Succeed(), "Failed to assert bootstrap API server stability")
Consistently(func() error {
kubeSystem := &corev1.Namespace{}
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")
}, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability")

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

By("Moving the cluster back to bootstrap")
clusterctl.Move(ctx, clusterctl.MoveInput{
Expand Down
Loading