This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new f3ec6f3  fix: The error handler trait should update status dependencies
f3ec6f3 is described below

commit f3ec6f361b0effc1a193e4e52a63ed8f37676463
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Tue Mar 1 19:00:04 2022 +0100

    fix: The error handler trait should update status dependencies
---
 pkg/trait/error_handler.go      | 5 +++--
 pkg/trait/error_handler_test.go | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/error_handler.go b/pkg/trait/error_handler.go
index f11d107..590f737 100644
--- a/pkg/trait/error_handler.go
+++ b/pkg/trait/error_handler.go
@@ -25,6 +25,7 @@ import (
 
        v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
        "github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+       "github.com/apache/camel-k/pkg/util"
 )
 
 // The error-handler is a platform trait used to inject Error Handler source 
into the integration runtime.
@@ -82,10 +83,10 @@ func (t *errorHandlerTrait) Apply(e *Environment) error {
 func (t *errorHandlerTrait) addErrorHandlerDependencies(e *Environment, uri 
string) {
        candidateComp, scheme := e.CamelCatalog.DecodeComponent(uri)
        if candidateComp != nil {
-               
e.Integration.Spec.AddDependency(candidateComp.GetDependencyID())
+               util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, 
candidateComp.GetDependencyID())
                if scheme != nil {
                        for _, dep := range 
candidateComp.GetProducerDependencyIDs(scheme.ID) {
-                               e.Integration.Spec.AddDependency(dep)
+                               
util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, dep)
                        }
                }
        }
diff --git a/pkg/trait/error_handler_test.go b/pkg/trait/error_handler_test.go
index c77d1ba..b582773 100644
--- a/pkg/trait/error_handler_test.go
+++ b/pkg/trait/error_handler_test.go
@@ -89,5 +89,5 @@ func TestErrorHandlerApplyDependency(t *testing.T) {
        assert.True(t, enabled)
        err = trait.Apply(e)
        assert.Nil(t, err)
-       assert.Equal(t, "camel:log", e.Integration.Spec.Dependencies[0])
+       assert.Equal(t, "camel:log", e.Integration.Status.Dependencies[0])
 }

Reply via email to