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

Refactor reconcileNormal function to accept context from caller #2219

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
28 changes: 14 additions & 14 deletions controllers/ibmpowervsmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (r *IBMPowerVSMachineReconciler) Reconcile(ctx context.Context, req ctrl.Re
}

// Handle non-deleted machines.
return r.reconcileNormal(machineScope)
return r.reconcileNormal(ctx, machineScope)
}

func (r *IBMPowerVSMachineReconciler) reconcileDelete(scope *scope.PowerVSMachineScope) (_ ctrl.Result, reterr error) {
Expand Down Expand Up @@ -207,26 +207,27 @@ func (r *IBMPowerVSMachineReconciler) handleLoadBalancerPoolMemberConfiguration(
return ctrl.Result{}, nil
}

func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerVSMachineScope) (ctrl.Result, error) {
machineScope.Info("Reconciling IBMPowerVSMachine")
func (r *IBMPowerVSMachineReconciler) reconcileNormal(ctx context.Context, machineScope *scope.PowerVSMachineScope) (ctrl.Result, error) {
log := ctrl.LoggerFrom(ctx)
log.V(3).Info("Reconciling IBMPowerVSMachine")

if !machineScope.Cluster.Status.InfrastructureReady {
machineScope.Info("Cluster infrastructure is not ready yet")
log.V(3).Info("Cluster infrastructure is not ready yet")
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.WaitingForClusterInfrastructureReason, capiv1beta1.ConditionSeverityInfo, "")
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
}

if machineScope.IBMPowerVSImage != nil {
if !machineScope.IBMPowerVSImage.Status.Ready {
machineScope.Info("IBMPowerVSImage is not ready yet")
log.V(3).Info("IBMPowerVSImage is not ready yet")
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.WaitingForIBMPowerVSImageReason, capiv1beta1.ConditionSeverityInfo, "")
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
}
}

// Make sure bootstrap data is available and populated.
if machineScope.Machine.Spec.Bootstrap.DataSecretName == nil {
machineScope.Info("Bootstrap data secret reference is not yet available")
log.V(3).Info("Bootstrap data secret reference is not yet available")
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.WaitingForBootstrapDataReason, capiv1beta1.ConditionSeverityInfo, "")
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
}
Expand All @@ -237,7 +238,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerV

ins, err := r.getOrCreate(machineScope)
if err != nil {
machineScope.Error(err, "Unable to create instance")
log.V(3).Error(err, "Unable to create instance")
conditions.MarkFalse(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, infrav1beta2.InstanceProvisionFailedReason, capiv1beta1.ConditionSeverityError, "%s", err.Error())
return ctrl.Result{}, fmt.Errorf("failed to reconcile VSI for IBMPowerVSMachine %s/%s: %w", machineScope.IBMPowerVSMachine.Namespace, machineScope.IBMPowerVSMachine.Name, err)
}
Expand Down Expand Up @@ -278,7 +279,7 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerV
return ctrl.Result{}, nil
default:
machineScope.SetNotReady()
machineScope.Info("PowerVS instance state is undefined", "state", *instance.Status, "instance-id", machineScope.GetInstanceID())
log.V(3).Info("PowerVS instance state is undefined", "state", *instance.Status, "instance-id", machineScope.GetInstanceID())
conditions.MarkUnknown(machineScope.IBMPowerVSMachine, infrav1beta2.InstanceReadyCondition, "", "")
}
} else {
Expand All @@ -291,24 +292,23 @@ func (r *IBMPowerVSMachineReconciler) reconcileNormal(machineScope *scope.PowerV
}

if machineScope.IBMPowerVSCluster.Spec.VPC == nil || machineScope.IBMPowerVSCluster.Spec.VPC.Region == nil {
machineScope.Info("Skipping configuring machine to loadbalancer as VPC is not set")
log.V(3).Info("Skipping configuring machine to loadbalancer as VPC is not set")
return ctrl.Result{}, nil
}

// Register instance with load balancer
machineScope.Info("updating loadbalancer for machine", "name", machineScope.IBMPowerVSMachine.Name)
log.V(3).Info("Updating loadbalancer for machine", "name", machineScope.IBMPowerVSMachine.Name)
internalIP := machineScope.GetMachineInternalIP()
if internalIP == "" {
machineScope.Info("Unable to update the LoadBalancer, Machine internal IP not yet set", "machineName", machineScope.IBMPowerVSMachine.Name)
log.V(3).Info("Unable to update the LoadBalancer, Machine internal IP not yet set", "machineName", machineScope.IBMPowerVSMachine.Name)
return ctrl.Result{}, nil
}

if util.IsControlPlaneMachine(machineScope.Machine) {
machineScope.Info("Configuring loadbalancer configuration for control plane machine", "machineName", machineScope.IBMPowerVSMachine.Name)
log.V(3).Info("Configuring loadbalancer configuration for control plane machine", "machineName", machineScope.IBMPowerVSMachine.Name)
return r.handleLoadBalancerPoolMemberConfiguration(machineScope)
}
machineScope.Info("skipping loadbalancer configuration for worker machine", "machineName", machineScope.IBMPowerVSMachine.Name)

log.V(3).Info("skipping loadbalancer configuration for worker machine", "machineName", machineScope.IBMPowerVSMachine.Name)
return ctrl.Result{}, nil
}

Expand Down
24 changes: 12 additions & 12 deletions controllers/ibmpowervsmachine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
},
IBMPowerVSMachine: &infrav1beta2.IBMPowerVSMachine{},
}
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
expectConditions(g, machineScope.IBMPowerVSMachine, []conditionAssertion{{infrav1beta2.InstanceReadyCondition, corev1.ConditionFalse, capiv1beta1.ConditionSeverityInfo, infrav1beta2.WaitingForClusterInfrastructureReason}})
Expand All @@ -412,7 +412,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
},
},
}
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
expectConditions(g, machineScope.IBMPowerVSMachine, []conditionAssertion{{infrav1beta2.InstanceReadyCondition, corev1.ConditionFalse, capiv1beta1.ConditionSeverityInfo, infrav1beta2.WaitingForIBMPowerVSImageReason}})
Expand All @@ -436,7 +436,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
},
},
}
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
expectConditions(g, machineScope.IBMPowerVSMachine, []conditionAssertion{{infrav1beta2.InstanceReadyCondition, corev1.ConditionFalse, capiv1beta1.ConditionSeverityInfo, infrav1beta2.WaitingForBootstrapDataReason}})
Expand Down Expand Up @@ -468,7 +468,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
}
mockpowervs.EXPECT().GetAllInstance().Return(instances, nil)

result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(HaveOccurred())
g.Expect(result.RequeueAfter).To(BeZero())
g.Expect(machineScope.IBMPowerVSMachine.Finalizers).To(ContainElement(infrav1beta2.IBMPowerVSMachineFinalizer))
Expand Down Expand Up @@ -564,7 +564,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
mockvpc.EXPECT().GetLoadBalancer(gomock.AssignableToTypeOf(&vpcv1.GetLoadBalancerOptions{})).Return(loadBalancer, &core.DetailedResponse{}, nil)
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).ToNot(BeNil())
g.Expect(result.Requeue).To((BeFalse()))
g.Expect(result.RequeueAfter).To(BeZero())
Expand Down Expand Up @@ -683,7 +683,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
mockvpc.EXPECT().ListLoadBalancerPoolMembers(gomock.AssignableToTypeOf(&vpcv1.ListLoadBalancerPoolMembersOptions{})).Return(loadBalancerPoolMemberCollection, &core.DetailedResponse{}, nil)
mockvpc.EXPECT().CreateLoadBalancerPoolMember(gomock.AssignableToTypeOf(&vpcv1.CreateLoadBalancerPoolMemberOptions{})).Return(loadBalancerPoolMember, &core.DetailedResponse{}, nil)
mockvpc.EXPECT().GetLoadBalancer(gomock.AssignableToTypeOf(&vpcv1.GetLoadBalancerOptions{})).Return(loadBalancer, &core.DetailedResponse{}, nil)
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
g.Expect(machineScope.IBMPowerVSMachine.Status.Ready).To(Equal(true))
Expand Down Expand Up @@ -743,7 +743,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {

mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
g.Expect(machineScope.IBMPowerVSMachine.Status.Ready).To(Equal(false))
Expand All @@ -754,7 +754,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
instance.Status = ptr.To("SHUTOFF")
mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
result, err = reconciler.reconcileNormal(machineScope)
result, err = reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(BeZero())
g.Expect(machineScope.IBMPowerVSMachine.Status.Ready).To(Equal(false))
Expand All @@ -765,7 +765,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
instance.Status = ptr.To("ACTIVE")
mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
result, err = reconciler.reconcileNormal(machineScope)
result, err = reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(BeZero())
g.Expect(machineScope.IBMPowerVSMachine.Status.Ready).To(Equal(true))
Expand All @@ -777,7 +777,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
instance.Fault = &models.PVMInstanceFault{Details: "Timeout creating instance"}
mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
result, err = reconciler.reconcileNormal(machineScope)
result, err = reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(BeZero())
g.Expect(machineScope.IBMPowerVSMachine.Status.Ready).To(Equal(false))
Expand All @@ -788,7 +788,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {
instance.Status = ptr.To("UNKNOWN")
mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
result, err = reconciler.reconcileNormal(machineScope)
result, err = reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
g.Expect(machineScope.IBMPowerVSMachine.Status.Ready).To(Equal(false))
Expand Down Expand Up @@ -876,7 +876,7 @@ func TestIBMPowerVSMachineReconciler_ReconcileOperations(t *testing.T) {

mockpowervs.EXPECT().GetAllInstance().Return(instanceReferences, nil)
mockpowervs.EXPECT().GetInstance(gomock.AssignableToTypeOf("capi-test-machine-id")).Return(instance, nil)
result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.Requeue).To(BeFalse())
g.Expect(result.RequeueAfter).To(BeZero())
Expand Down
11 changes: 7 additions & 4 deletions controllers/ibmvpcmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (r *IBMVPCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}

// Handle non-deleted machines.
return r.reconcileNormal(machineScope)
return r.reconcileNormal(ctx, machineScope)
}

// SetupWithManager creates a new IBMVPCMachine controller for a manager.
Expand All @@ -140,14 +140,17 @@ func (r *IBMVPCMachineReconciler) SetupWithManager(mgr ctrl.Manager) error {
Complete(r)
}

func (r *IBMVPCMachineReconciler) reconcileNormal(machineScope *scope.MachineScope) (ctrl.Result, error) { //nolint:gocyclo
func (r *IBMVPCMachineReconciler) reconcileNormal(ctx context.Context, machineScope *scope.MachineScope) (ctrl.Result, error) { //nolint:gocyclo
log := ctrl.LoggerFrom(ctx)
log.V(3).Info("Reconciling IBMVPCMachine")

if controllerutil.AddFinalizer(machineScope.IBMVPCMachine, infrav1beta2.MachineFinalizer) {
return ctrl.Result{}, nil
}

// Make sure bootstrap data is available and populated.
if machineScope.Machine.Spec.Bootstrap.DataSecretName == nil {
machineScope.Info("Bootstrap data secret reference is not yet available")
log.V(3).Info("Bootstrap data secret reference is not yet available")
return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil
}

Expand Down Expand Up @@ -203,7 +206,7 @@ func (r *IBMVPCMachineReconciler) reconcileNormal(machineScope *scope.MachineSco
machineRunning = true
default:
machineScope.SetNotReady()
machineScope.V(3).Info("unexpected vpc instance status", "instanceStatus", *instance.Status, "instanceID", machineScope.GetInstanceID())
log.V(3).Info("unexpected vpc instance status", "instanceStatus", *instance.Status, "instanceID", machineScope.GetInstanceID())
conditions.MarkUnknown(machineScope.IBMVPCMachine, infrav1beta2.InstanceReadyCondition, "", "")
}
} else {
Expand Down
20 changes: 10 additions & 10 deletions controllers/ibmvpcmachine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func TestIBMVPCMachineReconciler_reconcile(t *testing.T) {
g := NewWithT(t)
setup(t)
t.Cleanup(teardown)
_, err := reconciler.reconcileNormal(machineScope)
_, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(machineScope.IBMVPCMachine.Finalizers).To(ContainElement(infrav1beta2.MachineFinalizer))
})
Expand All @@ -271,7 +271,7 @@ func TestIBMVPCMachineReconciler_reconcile(t *testing.T) {
machineScope.Machine.Spec.Bootstrap.DataSecretName = ptr.To("capi-machine")
machineScope.IBMVPCCluster.Status.Subnet.ID = ptr.To("capi-subnet-id")
mockvpc.EXPECT().ListInstances(options).Return(instancelist, response, errors.New("Failed to create or fetch instance"))
_, err := reconciler.reconcileNormal(machineScope)
_, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(Not(BeNil()))
g.Expect(machineScope.IBMVPCMachine.Finalizers).To(ContainElement(infrav1beta2.MachineFinalizer))
})
Expand Down Expand Up @@ -387,7 +387,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
mockgt.EXPECT().GetTagByName(gomock.AssignableToTypeOf("capi-cluster")).Return(existingTag, nil)
mockgt.EXPECT().AttachTag(gomock.AssignableToTypeOf(&globaltaggingv1.AttachTagOptions{})).Return(nil, &core.DetailedResponse{}, nil)

_, err := reconciler.reconcileNormal(machineScope)
_, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To((Not(BeNil())))
g.Expect(machineScope.IBMVPCMachine.Finalizers).To(ContainElement(infrav1beta2.MachineFinalizer))
})
Expand All @@ -402,7 +402,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
mockvpc.EXPECT().GetLoadBalancer(gomock.AssignableToTypeOf(&vpcv1.GetLoadBalancerOptions{})).Return(loadBalancer, &core.DetailedResponse{}, nil)
mockvpc.EXPECT().ListLoadBalancerPoolMembers(gomock.AssignableToTypeOf(&vpcv1.ListLoadBalancerPoolMembersOptions{})).Return(&vpcv1.LoadBalancerPoolMemberCollection{}, &core.DetailedResponse{}, errors.New("failed to list loadBalancerPoolMembers"))

_, err := reconciler.reconcileNormal(machineScope)
_, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(Not(BeNil()))
g.Expect(machineScope.IBMVPCMachine.Finalizers).To(ContainElement(infrav1beta2.MachineFinalizer))
})
Expand All @@ -422,7 +422,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
mockvpc.EXPECT().ListLoadBalancerPoolMembers(gomock.AssignableToTypeOf(&vpcv1.ListLoadBalancerPoolMembersOptions{})).Return(&vpcv1.LoadBalancerPoolMemberCollection{}, &core.DetailedResponse{}, nil)
mockvpc.EXPECT().CreateLoadBalancerPoolMember(gomock.AssignableToTypeOf(&vpcv1.CreateLoadBalancerPoolMemberOptions{})).Return(customloadBalancerPoolMember, &core.DetailedResponse{}, nil)

result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
// Requeue should be set when the Pool Member is found, but not yet ready (active).
g.Expect(result.RequeueAfter).To(Not(BeZero()))
g.Expect(err).To(BeNil())
Expand All @@ -446,7 +446,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
mockvpc.EXPECT().ListLoadBalancerPoolMembers(gomock.AssignableToTypeOf(&vpcv1.ListLoadBalancerPoolMembersOptions{})).Return(&vpcv1.LoadBalancerPoolMemberCollection{}, &core.DetailedResponse{}, nil)
mockvpc.EXPECT().CreateLoadBalancerPoolMember(gomock.AssignableToTypeOf(&vpcv1.CreateLoadBalancerPoolMemberOptions{})).Return(loadBalancerPoolMember, &core.DetailedResponse{}, nil)

_, err := reconciler.reconcileNormal(machineScope)
_, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(machineScope.IBMVPCMachine.Finalizers).To(ContainElement(infrav1beta2.MachineFinalizer))
g.Expect(machineScope.IBMVPCMachine.Status.Ready).To(Equal(true))
Expand Down Expand Up @@ -488,7 +488,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
}
mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(customInstancelist, &core.DetailedResponse{}, nil)

result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
g.Expect(machineScope.IBMVPCMachine.Status.Ready).To(Equal(false))
Expand All @@ -513,7 +513,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
}
mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(customInstancelist, &core.DetailedResponse{}, nil)

_, err := reconciler.reconcileNormal(machineScope)
_, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(machineScope.IBMVPCMachine.Status.Ready).To(Equal(true))
})
Expand All @@ -537,7 +537,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
}
mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(customInstancelist, &core.DetailedResponse{}, nil)

result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(Not(BeZero()))
g.Expect(machineScope.IBMVPCMachine.Status.Ready).To(Equal(false))
Expand All @@ -562,7 +562,7 @@ func TestIBMVPCMachineLBReconciler_reconcile(t *testing.T) {
}
mockvpc.EXPECT().ListInstances(gomock.AssignableToTypeOf(&vpcv1.ListInstancesOptions{})).Return(customInstancelist, &core.DetailedResponse{}, nil)

result, err := reconciler.reconcileNormal(machineScope)
result, err := reconciler.reconcileNormal(ctx, machineScope)
g.Expect(err).To(BeNil())
g.Expect(result.RequeueAfter).To(BeZero())
g.Expect(machineScope.IBMVPCMachine.Status.Ready).To(Equal(false))
Expand Down