From fcf7849ac25ed71451a2258c61b0cacf290e1b1c Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Mon, 8 Jan 2024 21:43:52 +0100 Subject: [PATCH] fix: orchestration topics --- .../internal/controllers/orchestration_controller.go | 3 ++- .../internal/controllers/orchestration_controller_test.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/operatorv2/internal/controllers/orchestration_controller.go b/components/operatorv2/internal/controllers/orchestration_controller.go index aa53f25233..9cd1e25e25 100644 --- a/components/operatorv2/internal/controllers/orchestration_controller.go +++ b/components/operatorv2/internal/controllers/orchestration_controller.go @@ -17,6 +17,7 @@ limitations under the License. package controllers import ( + "fmt" "github.com/formancehq/operator/v2/api/v1beta1" . "github.com/formancehq/operator/v2/internal/core" "github.com/formancehq/operator/v2/internal/resources/authclients" @@ -131,7 +132,7 @@ func (r *OrchestrationController) createDeployment(ctx Context, stack *v1beta1.S Env("TEMPORAL_NAMESPACE", orchestration.Spec.Temporal.Namespace), Env("WORKER", "true"), Env("TOPICS", strings.Join(Map(eventPublishers, func(from unstructured.Unstructured) string { - return from.GetName() + return fmt.Sprintf("%s-%s", stack.Name, strings.ToLower(from.GetKind())) }), " ")), ) diff --git a/components/operatorv2/internal/controllers/orchestration_controller_test.go b/components/operatorv2/internal/controllers/orchestration_controller_test.go index a27db58578..5e97aeff6b 100644 --- a/components/operatorv2/internal/controllers/orchestration_controller_test.go +++ b/components/operatorv2/internal/controllers/orchestration_controller_test.go @@ -1,9 +1,10 @@ package controllers_test import ( + "fmt" "github.com/formancehq/operator/v2/api/v1beta1" . "github.com/formancehq/operator/v2/internal/controllers/testing" - "github.com/formancehq/operator/v2/internal/core" + core "github.com/formancehq/operator/v2/internal/core" "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -92,6 +93,10 @@ var _ = Describe("OrchestrationController", func() { return LoadResource(stack.Name, "orchestration", deployment) }).Should(Succeed()) Expect(deployment).To(BeControlledBy(orchestration)) + Expect(deployment.Spec.Template.Spec.Containers[0].Env).To(ContainElements( + core.Env("WORKER", "true"), + core.Env("TOPICS", fmt.Sprintf("%s-ledger", stack.Name)), + )) }) It("Should create a new HTTPAPI object", func() { httpService := &v1beta1.HTTPAPI{}