Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
syntassodev committed May 10, 2024
2 parents bd946b4 + 519a422 commit 440f2bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions controllers/promise_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ func (r *PromiseReconciler) generateStatusAndMarkRequirements(ctx context.Contex

func (r *PromiseReconciler) reconcileDependencies(o opts, promise *v1alpha1.Promise, configurePipeline []v1alpha1.Pipeline) (*ctrl.Result, error) {
o.logger.Info("Applying static dependencies for Promise", "promise", promise.GetName())
if err := r.applyWorkForDependencies(o, promise); err != nil {
o.logger.Error(err, "Error creating Works")
return nil, err
if len(promise.Spec.Dependencies) > 0 {
if err := r.applyWorkForDependencies(o, promise); err != nil {
o.logger.Error(err, "Error creating Works")
return nil, err
}
}
if len(configurePipeline) == 0 {
return nil, nil
Expand Down
8 changes: 7 additions & 1 deletion controllers/promise_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@ var _ = Describe("PromiseController", func() {
Expect(err).NotTo(HaveOccurred())
Expect(result).To(Equal(ctrl.Result{}))
})

By("not creating a Work for the empty static dependencies", func() {
works := &v1alpha1.WorkList{}
Expect(fakeK8sClient.List(ctx, works)).To(Succeed())
Expect(works.Items).To(HaveLen(0))
})
})
})

Expand Down Expand Up @@ -585,7 +591,7 @@ var _ = Describe("PromiseController", func() {
Expect(fakeK8sClient.List(ctx, serviceAccounts)).To(Succeed())
Expect(clusterRoles.Items).To(HaveLen(1))
Expect(clusterRoleBindings.Items).To(HaveLen(1))
Expect(works.Items).To(HaveLen(1))
Expect(works.Items).To(HaveLen(0))
Expect(jobs.Items).To(HaveLen(0))
Expect(serviceAccounts.Items).To(HaveLen(0))

Expand Down

0 comments on commit 440f2bb

Please sign in to comment.