From b7f542603f3e5a6fdcbbde6ad9443f0ef9af93e3 Mon Sep 17 00:00:00 2001 From: grzegorz-ciezkowski Date: Thu, 12 Dec 2024 10:48:00 +0100 Subject: [PATCH] feat(teams) Team controller is running in team meme=bership tests (#723) --- pkg/controllers/team/team_controller_test.go | 8 +++++--- pkg/controllers/teammembership/suite_test.go | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/controllers/team/team_controller_test.go b/pkg/controllers/team/team_controller_test.go index d56a544ac..892220e73 100644 --- a/pkg/controllers/team/team_controller_test.go +++ b/pkg/controllers/team/team_controller_test.go @@ -10,6 +10,8 @@ import ( "github.com/cloudoperators/greenhouse/pkg/test" ) +const teamName = "test-team-0000" + var _ = Describe("TeamControllerTest", Ordered, func() { It("Should update status of team with members", func() { err := test.K8sClient.Create(test.Ctx, &greenhouseapisv1alpha1.Team{ @@ -18,7 +20,7 @@ var _ = Describe("TeamControllerTest", Ordered, func() { APIVersion: greenhouseapisv1alpha1.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ - Name: "test-team", + Name: teamName, Namespace: test.TestNamespace, }, Spec: greenhouseapisv1alpha1.TeamSpec{ @@ -40,7 +42,7 @@ var _ = Describe("TeamControllerTest", Ordered, func() { { APIVersion: greenhouseapisv1alpha1.GroupVersion.String(), Kind: "Team", - Name: "test-team", + Name: teamName, UID: "uhuihiuh", }, }, @@ -60,7 +62,7 @@ var _ = Describe("TeamControllerTest", Ordered, func() { Eventually(func(g Gomega) { team := &greenhouseapisv1alpha1.Team{} - err := test.K8sClient.Get(test.Ctx, client.ObjectKey{Name: "test-team", Namespace: test.TestNamespace}, team) + err := test.K8sClient.Get(test.Ctx, client.ObjectKey{Name: teamName, Namespace: test.TestNamespace}, team) g.Expect(err).ToNot(HaveOccurred()) g.Expect(team.Status.Members).To(HaveLen(1)) }).Should(Succeed()) diff --git a/pkg/controllers/teammembership/suite_test.go b/pkg/controllers/teammembership/suite_test.go index 41b0cd556..016b45ea2 100644 --- a/pkg/controllers/teammembership/suite_test.go +++ b/pkg/controllers/teammembership/suite_test.go @@ -10,6 +10,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/cloudoperators/greenhouse/pkg/controllers/team" "github.com/cloudoperators/greenhouse/pkg/controllers/teammembership" "github.com/cloudoperators/greenhouse/pkg/scim" "github.com/cloudoperators/greenhouse/pkg/test" @@ -30,6 +31,7 @@ var _ = BeforeSuite(func() { test.RegisterController("teammembershipUpdaterController", (&teammembership.TeamMembershipUpdaterController{}).SetupWithManager) + test.RegisterController("teamController", (&team.TeamReconciler{}).SetupWithManager) test.TestBeforeSuite() })