Fix: fix unhandled err (#2423)

* Fix: fix unhandled err

refer to https://lift.sonatype.com/result/bhamail/kubevela/01FFT7CSVNCPF6808ZM856V3HN?tab=results

* Test: fix panic err
This commit is contained in:
Tianxin Dong
2021-10-12 14:36:09 +08:00
committed by GitHub
parent 96c52ab2fc
commit 287c895daf
6 changed files with 29 additions and 11 deletions
@@ -284,7 +284,7 @@ func (r *Reconciler) handleFinalizers(ctx context.Context, envBinding *v1alpha1.
func (r *Reconciler) endWithNegativeCondition(ctx context.Context, envBinding *v1alpha1.EnvBinding, cond condition.Condition) (ctrl.Result, error) {
envBinding.SetConditions(cond)
if err := r.Client.Status().Patch(ctx, envBinding, client.Merge); err != nil {
return ctrl.Result{}, errors.WithMessage(err, "cannot update initializer status")
return ctrl.Result{}, errors.WithMessage(err, "cannot update envbinding status")
}
// if any condition is changed, patching status can trigger requeue the resource and we should return nil to
// avoid requeue it again
@@ -663,7 +663,6 @@ var _ = Describe("EnvBinding Normal tests", func() {
By("Create envBinding")
Expect(k8sClient.Create(ctx, envBinding)).Should(BeNil())
testutil.ReconcileOnce(&r, req)
testutil.ReconcileRetry(&r, req)
By("Check the Application created by EnvBinding Controller")