go operator test check for failure inside reconciler

Viewed 35

I have a simple reconciler logic to check for resource exist. If object don't exist then return an error, so essentially it will be requeued.

if err := r.Provider.EnsureData(ctx, Data); err != nil {
        rlog.Error(errors.Errorf("unable to check data %s exists", Data), Data)

        if err != nil {

            // then go to the beginning of the reconcile
            return ctrl.Result{}, err
        }

        return ctrl.Result{}, errors.Errorf("unable to ensure Data %s exists", Data)
    } 

So when I unit test it using Ginko , how do I check if there was an error during Reconcile ?

0 Answers
Related