Skip to content

Commit 7f9d912

Browse files
committed
Bump go version to 1.24
1 parent 4f90210 commit 7f9d912

12 files changed

+15
-25
lines changed

api/v1beta1/gcpcluster_webhook_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"testing"
2221

2322
. "github.com/onsi/gomega"
@@ -90,7 +89,7 @@ func TestGCPCluster_ValidateUpdate(t *testing.T) {
9089
for _, test := range tests {
9190
t.Run(test.name, func(t *testing.T) {
9291
t.Parallel()
93-
warn, err := (&gcpClusterWebhook{}).ValidateUpdate(context.Background(), test.oldCluster, test.newCluster)
92+
warn, err := (&gcpClusterWebhook{}).ValidateUpdate(t.Context(), test.oldCluster, test.newCluster)
9493
if test.wantErr {
9594
g.Expect(err).To(HaveOccurred())
9695
} else {

api/v1beta1/gcpclustertemplate_webhook_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"testing"
2221

2322
. "github.com/onsi/gomega"
@@ -84,7 +83,7 @@ func TestGCPClusterTemplate_ValidateUpdate(t *testing.T) {
8483
for _, test := range tests {
8584
t.Run(test.name, func(t *testing.T) {
8685
t.Parallel()
87-
warn, err := (&gcpClusterTemplateWebhook{}).ValidateUpdate(context.Background(), test.oldTemplate, test.newTemplate)
86+
warn, err := (&gcpClusterTemplateWebhook{}).ValidateUpdate(t.Context(), test.oldTemplate, test.newTemplate)
8887
if test.wantErr {
8988
g.Expect(err).To(HaveOccurred())
9089
} else {

api/v1beta1/gcpmachine_webhook_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"testing"
2221

2322
. "github.com/onsi/gomega"
@@ -273,7 +272,7 @@ func TestGCPMachine_ValidateCreate(t *testing.T) {
273272
for _, test := range tests {
274273
t.Run(test.name, func(t *testing.T) {
275274
t.Parallel()
276-
warn, err := (&gcpMachineWebhook{}).ValidateCreate(context.Background(), test.GCPMachine)
275+
warn, err := (&gcpMachineWebhook{}).ValidateCreate(t.Context(), test.GCPMachine)
277276
if test.wantErr {
278277
g.Expect(err).To(HaveOccurred())
279278
} else {

api/v1beta1/gcpmachinetemplate_webhook_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"testing"
2221

2322
. "github.com/onsi/gomega"
@@ -233,7 +232,7 @@ func TestGCPMachineTemplate_ValidateCreate(t *testing.T) {
233232
for _, test := range tests {
234233
t.Run(test.name, func(t *testing.T) {
235234
t.Parallel()
236-
warn, err := (&gcpMachineTemplateWebhook{}).ValidateCreate(context.Background(), test.template)
235+
warn, err := (&gcpMachineTemplateWebhook{}).ValidateCreate(t.Context(), test.template)
237236
if test.wantErr {
238237
g.Expect(err).To(HaveOccurred())
239238
} else {

controllers/gcpcluster_controller_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package controllers
1919
import (
2020
. "github.com/onsi/ginkgo/v2"
2121
. "github.com/onsi/gomega"
22-
"golang.org/x/net/context"
2322
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2423
infrav1 "sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1"
2524
ctrl "sigs.k8s.io/controller-runtime"
@@ -32,7 +31,7 @@ var _ = Describe("GCPClusterReconciler", func() {
3231

3332
Context("Reconcile an GCPCluster", func() {
3433
It("should not error and not requeue the request with insufficient set up", func() {
35-
ctx := context.Background()
34+
ctx := t.Context()
3635

3736
reconciler := &GCPClusterReconciler{
3837
Client: k8sClient,

controllers/gcpmachine_controller_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"context"
21-
2220
. "github.com/onsi/ginkgo/v2"
2321
. "github.com/onsi/gomega"
2422
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -37,7 +35,7 @@ var _ = Describe("GCPMachineReconciler", func() {
3735
Client: k8sClient,
3836
}
3937
By("Calling reconcile")
40-
ctx := context.Background()
38+
ctx := t.Context()
4139
instance := &infrav1.GCPMachine{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}}
4240
result, err := reconciler.Reconcile(ctx, ctrl.Request{
4341
NamespacedName: client.ObjectKey{

exp/api/v1beta1/gcpmanagedcluster_webhook_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"testing"
2221

2322
. "github.com/onsi/gomega"
@@ -101,7 +100,7 @@ func TestGCPManagedClusterValidatingWebhookUpdate(t *testing.T) {
101100
},
102101
}
103102

104-
warn, err := (&gcpManagedClusterWebhook{}).ValidateUpdate(context.Background(), oldMC, newMC)
103+
warn, err := (&gcpManagedClusterWebhook{}).ValidateUpdate(t.Context(), oldMC, newMC)
105104

106105
if tc.expectError {
107106
g.Expect(err).To(HaveOccurred())

exp/api/v1beta1/gcpmanagedcontrolplane_webhook_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"strings"
2221
"testing"
2322

@@ -110,7 +109,7 @@ func TestGCPManagedControlPlaneDefaultingWebhook(t *testing.T) {
110109
},
111110
Spec: tc.spec,
112111
}
113-
err := (&gcpManagedControlPlaneWebhook{}).Default(context.Background(), mcp)
112+
err := (&gcpManagedControlPlaneWebhook{}).Default(t.Context(), mcp)
114113
g.Expect(err).NotTo(HaveOccurred())
115114

116115
g.Expect(mcp.Spec).ToNot(BeNil())
@@ -193,7 +192,7 @@ func TestGCPManagedControlPlaneValidatingWebhookCreate(t *testing.T) {
193192
mcp := &GCPManagedControlPlane{
194193
Spec: tc.spec,
195194
}
196-
warn, err := (&gcpManagedControlPlaneWebhook{}).ValidateCreate(context.Background(), mcp)
195+
warn, err := (&gcpManagedControlPlaneWebhook{}).ValidateCreate(t.Context(), mcp)
197196

198197
if tc.expectError {
199198
g.Expect(err).To(HaveOccurred())
@@ -288,7 +287,7 @@ func TestGCPManagedControlPlaneValidatingWebhookUpdate(t *testing.T) {
288287
},
289288
}
290289

291-
warn, err := (&gcpManagedControlPlaneWebhook{}).ValidateUpdate(context.Background(), oldMCP, newMCP)
290+
warn, err := (&gcpManagedControlPlaneWebhook{}).ValidateUpdate(t.Context(), oldMCP, newMCP)
292291

293292
if tc.expectError {
294293
g.Expect(err).To(HaveOccurred())

exp/api/v1beta1/gcpmanagedmachinepool_webhook_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"context"
2120
"strings"
2221
"testing"
2322

@@ -148,7 +147,7 @@ func TestGCPManagedMachinePoolValidatingWebhookCreate(t *testing.T) {
148147
mmp := &GCPManagedMachinePool{
149148
Spec: tc.spec,
150149
}
151-
warn, err := (&gcpManagedMachinePoolWebhook{}).ValidateCreate(context.Background(), mmp)
150+
warn, err := (&gcpManagedMachinePoolWebhook{}).ValidateCreate(t.Context(), mmp)
152151

153152
if tc.expectError {
154153
g.Expect(err).To(HaveOccurred())
@@ -215,7 +214,7 @@ func TestGCPManagedMachinePoolValidatingWebhookUpdate(t *testing.T) {
215214
},
216215
}
217216

218-
warn, err := (&gcpManagedMachinePoolWebhook{}).ValidateUpdate(context.Background(), oldMMP, newMMP)
217+
warn, err := (&gcpManagedMachinePoolWebhook{}).ValidateUpdate(t.Context(), oldMMP, newMMP)
219218

220219
if tc.expectError {
221220
g.Expect(err).To(HaveOccurred())

exp/bootstrap/gke/controllers/gkeconfig_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (r *GKEConfigReconciler) ManagedMachinePoolToGKEConfigMapFunc(_ context.Con
133133
klog.Errorf("Expected a Cluster but got a %T", o)
134134
}
135135

136-
machinePool, err := getOwnerMachinePool(context.Background(), r.Client, c.ObjectMeta)
136+
machinePool, err := getOwnerMachinePool(t.Context(), r.Client, c.ObjectMeta)
137137
if err != nil {
138138
klog.Errorf("Failed to get owner MachinePool for GCPManagedMachinePool %s/%s: %v", c.Namespace, c.Name, err)
139139
return nil

0 commit comments

Comments
 (0)