Skip to content

Commit

Permalink
feat(teams) Team controller is running in team meme=bership tests (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
gciezkowski-acc committed Dec 16, 2024
1 parent 23bf710 commit 61739a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/controllers/team/team_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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{
Expand All @@ -40,7 +42,7 @@ var _ = Describe("TeamControllerTest", Ordered, func() {
{
APIVersion: greenhouseapisv1alpha1.GroupVersion.String(),
Kind: "Team",
Name: "test-team",
Name: teamName,
UID: "uhuihiuh",
},
},
Expand All @@ -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())
Expand Down
2 changes: 2 additions & 0 deletions pkg/controllers/teammembership/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -30,6 +31,7 @@ var _ = BeforeSuite(func() {

test.RegisterController("teammembershipUpdaterController",
(&teammembership.TeamMembershipUpdaterController{}).SetupWithManager)
test.RegisterController("teamController", (&team.TeamReconciler{}).SetupWithManager)
test.TestBeforeSuite()
})

Expand Down

0 comments on commit 61739a8

Please sign in to comment.