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

ManagedCluster controller test enhancement #822

Closed
BROngineer opened this issue Dec 20, 2024 · 0 comments · Fixed by #830
Closed

ManagedCluster controller test enhancement #822

BROngineer opened this issue Dec 20, 2024 · 0 comments · Fixed by #830
Assignees
Labels
bug Something isn't working

Comments

@BROngineer
Copy link
Contributor

Description

Current test suite runs reconciliation and checks whether error occurred or not:

https://github.com/Mirantis/hmc/blob/2e92fb6880d955204e4e923d0ab92437e2719974/internal/controller/managedcluster_controller_test.go#L215-L226

However, reconciler exits after adding finalizer to the resource being reconciled:

// managedcluster_controller.go

...
func (r *ManagedClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
    ...
    return r.reconcileUpdate(ctx, managedCluster)
}

func (r *ManagedClusterReconciler) reconcileUpdate(ctx context.Context, mc *hmc.ManagedCluster) (_ ctrl.Result, err error) {
...

    if controllerutil.AddFinalizer(mc, hmc.ManagedClusterFinalizer) {
        if err := r.Client.Update(ctx, mc); err != nil {
            return ctrl.Result{}, fmt.Errorf("failed to update managedCluster %s/%s: %w", mc.Namespace, mc.Name, err)
        }
        return ctrl.Result{}, nil
    }
...

Expected behaviour

Object should be reconciled until it eventually enters desired state defined by test-case parameters or test should fail by timeout.

@BROngineer BROngineer self-assigned this Dec 20, 2024
@BROngineer BROngineer moved this from Todo to In Progress in Project 2A Dec 20, 2024
@DinaBelova DinaBelova added the bug Something isn't working label Dec 20, 2024
@alex-shl alex-shl added this to k0rdent Jan 3, 2025
@alex-shl alex-shl moved this to In Progress in k0rdent Jan 3, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in k0rdent Jan 6, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Project 2A Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants