Skip to content

Commit 9e0cf62

Browse files
authored
Merge pull request #13027 from sivchari/migrate-machinepool-requeue-to-requeueafter
🌱 Migrate from Requeue to RequeueAfter in MachinePool tests
2 parents d900187 + 9d431dd commit 9e0cf62

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

.golangci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,6 @@ linters:
274274
- linters:
275275
- staticcheck
276276
text: 'SA1019: .*\.Deprecated\.V1Beta1.* is deprecated'
277-
# CR v0.21 deprecated Result.Requeue, will be fixed incrementally and tracked via https://github.com/kubernetes-sigs/cluster-api/issues/12272
278-
- linters:
279-
- staticcheck
280-
text: 'SA1019: .*(res|result|i|j)\.Requeue is deprecated: Use `RequeueAfter` instead'
281-
# TODO: Remove Requeue step by step
282-
path: internal/controllers/machinepool
283277
# TODO: var-naming: avoid meaningless package names by revive
284278
# * test/infrastructure/docker/internal/docker/types/
285279
# * bootstrap/kubeadm/types/

internal/controllers/machinepool/machinepool_controller_phases_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
147147

148148
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
149149
g.Expect(err).ToNot(HaveOccurred())
150-
g.Expect(res.Requeue).To(BeFalse())
150+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
151151

152152
r.reconcilePhase(machinepool)
153153

@@ -190,7 +190,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
190190

191191
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
192192
g.Expect(err).ToNot(HaveOccurred())
193-
g.Expect(res.Requeue).To(BeFalse())
193+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
194194

195195
r.reconcilePhase(machinepool)
196196
g.Expect(machinepool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhasePending))
@@ -230,7 +230,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
230230

231231
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
232232
g.Expect(err).ToNot(HaveOccurred())
233-
g.Expect(res.Requeue).To(BeFalse())
233+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
234234

235235
r.reconcilePhase(machinepool)
236236
g.Expect(machinepool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhaseProvisioning))
@@ -286,7 +286,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
286286

287287
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
288288
g.Expect(err).ToNot(HaveOccurred())
289-
g.Expect(res.Requeue).To(BeFalse())
289+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
290290

291291
// Set ReadyReplicas
292292
machinepool.Status.Deprecated = &clusterv1.MachinePoolDeprecatedStatus{
@@ -358,7 +358,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
358358

359359
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
360360
g.Expect(err).ToNot(HaveOccurred())
361-
g.Expect(res.Requeue).To(BeFalse())
361+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
362362

363363
// Set ReadyReplicas
364364
machinepool.Status.Deprecated = &clusterv1.MachinePoolDeprecatedStatus{
@@ -408,7 +408,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
408408

409409
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
410410
g.Expect(err).ToNot(HaveOccurred())
411-
g.Expect(res.Requeue).To(BeFalse())
411+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
412412

413413
r.reconcilePhase(machinepool)
414414
g.Expect(machinepool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhaseProvisioned))
@@ -461,7 +461,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
461461

462462
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
463463
g.Expect(err).ToNot(HaveOccurred())
464-
g.Expect(res.Requeue).To(BeFalse())
464+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
465465

466466
// Set ReadyReplicas
467467
machinepool.Status.Deprecated = &clusterv1.MachinePoolDeprecatedStatus{
@@ -531,7 +531,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
531531

532532
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
533533
g.Expect(err).ToNot(HaveOccurred())
534-
g.Expect(res.Requeue).To(BeFalse())
534+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
535535

536536
// Set ReadyReplicas
537537
machinepool.Status.Deprecated = &clusterv1.MachinePoolDeprecatedStatus{
@@ -607,7 +607,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
607607

608608
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
609609
g.Expect(err).ToNot(HaveOccurred())
610-
g.Expect(res.Requeue).To(BeFalse())
610+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
611611

612612
r.reconcilePhase(machinepool)
613613
g.Expect(machinepool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhaseDeleting))
@@ -681,7 +681,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
681681

682682
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
683683
g.Expect(err).ToNot(HaveOccurred())
684-
g.Expect(res.Requeue).To(BeFalse())
684+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
685685

686686
r.reconcilePhase(machinePool)
687687
g.Expect(machinePool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhaseRunning))
@@ -701,7 +701,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
701701
// Reconcile again. The new bootstrap config should be used.
702702
res, err = doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
703703
g.Expect(err).ToNot(HaveOccurred())
704-
g.Expect(res.Requeue).To(BeFalse())
704+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
705705

706706
r.reconcilePhase(machinePool)
707707
g.Expect(*machinePool.Spec.Template.Spec.Bootstrap.DataSecretName).To(Equal("secret-data-new"))
@@ -777,7 +777,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
777777

778778
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
779779
g.Expect(err).ToNot(HaveOccurred())
780-
g.Expect(res.Requeue).To(BeFalse())
780+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
781781

782782
r.reconcilePhase(machinePool)
783783
g.Expect(machinePool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhaseRunning))
@@ -801,7 +801,7 @@ func TestReconcileMachinePoolPhases(t *testing.T) {
801801
g.Expect(err).ToNot(HaveOccurred())
802802

803803
// Controller should wait until bootstrap provider reports ready bootstrap config
804-
g.Expect(res.Requeue).To(BeFalse())
804+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
805805

806806
r.reconcilePhase(machinePool)
807807

@@ -1858,7 +1858,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
18581858

18591859
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
18601860
g.Expect(err).ToNot(HaveOccurred())
1861-
g.Expect(res.Requeue).To(BeFalse())
1861+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
18621862

18631863
r.reconcilePhase(machinepool)
18641864

@@ -1926,7 +1926,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
19261926

19271927
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
19281928
g.Expect(err).ToNot(HaveOccurred())
1929-
g.Expect(res.Requeue).To(BeFalse())
1929+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
19301930

19311931
r.reconcilePhase(machinepool)
19321932
g.Expect(machinepool.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePoolPhaseRunning))
@@ -1977,7 +1977,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
19771977

19781978
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
19791979
g.Expect(err).ToNot(HaveOccurred())
1980-
g.Expect(res.Requeue).To(BeFalse())
1980+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
19811981

19821982
r.reconcilePhase(machinepool)
19831983

@@ -2024,7 +2024,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
20242024

20252025
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
20262026
g.Expect(err).ToNot(HaveOccurred())
2027-
g.Expect(res.Requeue).To(BeFalse())
2027+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
20282028

20292029
r.reconcilePhase(machinepool)
20302030

@@ -2093,7 +2093,7 @@ func TestReconcileMachinePoolScaleToFromZero(t *testing.T) {
20932093

20942094
res, err := doReconcile(ctx, scope, reconcileNormalFuncsForTest(r))
20952095
g.Expect(err).ToNot(HaveOccurred())
2096-
g.Expect(res.Requeue).To(BeFalse())
2096+
g.Expect(res.RequeueAfter).To(Equal(time.Duration(0)))
20972097

20982098
r.reconcilePhase(machinepool)
20992099

0 commit comments

Comments
 (0)