Skip to content

Commit

Permalink
Fix DIC returned reconcile.Result for ImageStream
Browse files Browse the repository at this point in the history
regression introduced in kubevirt#2700

Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
  • Loading branch information
arnongilboa committed Jul 27, 2023
1 parent 309c4f3 commit d8c4d5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pkg/controller/dataimportcron-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,11 @@ func (r *DataImportCronReconciler) update(ctx context.Context, dataImportCron *c
return res, err
}

// We use the poller returned reconcile.Result for RequeueAfter if needed
// skip if we disabled schedule
// Skip if schedule is disabled
if isImageStreamSource(dataImportCron) && dataImportCron.Spec.Schedule != "" {
res, err := r.pollImageStreamDigest(ctx, dataImportCron)
// We use the poll returned reconcile.Result for RequeueAfter if needed
// res is the func returned result, so it must not be block-scoped
res, err = r.pollImageStreamDigest(ctx, dataImportCron)
if err != nil {
return res, err
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller/dataimportcron-controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,10 @@ var _ = Describe("All DataImportCron Tests", func() {
imageStream := newImageStream(imageStreamName)
imageStream.Status.Tags = imageStream.Status.Tags[imageStreamTagsFromIndex:]
reconciler = createDataImportCronReconciler(cron, imageStream)
_, err := reconciler.Reconcile(context.TODO(), cronReq)
res, err := reconciler.Reconcile(context.TODO(), cronReq)
Expect(err).ToNot(HaveOccurred())
Expect(res.Requeue).To(BeTrue())
Expect(res.RequeueAfter.Seconds()).To(And(BeNumerically(">", 0), BeNumerically("<=", 60)))

err = reconciler.client.Get(context.TODO(), cronKey, cron)
Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit d8c4d5f

Please sign in to comment.