generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(teams) Update unit test and update (#723)
- Loading branch information
1 parent
96c1e4a
commit aed3ad7
Showing
2 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,10 @@ import ( | |
"github.com/cloudoperators/greenhouse/pkg/test" | ||
) | ||
|
||
const teamName = "test-team-0000" | ||
const ( | ||
teamName = "test-team" | ||
anotherTeamName = "another-test-team" | ||
) | ||
|
||
var _ = Describe("TeamControllerTest", Ordered, func() { | ||
It("Should update status of team with members", func() { | ||
|
@@ -63,6 +66,42 @@ var _ = Describe("TeamControllerTest", Ordered, func() { | |
}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
err = test.K8sClient.Create(test.Ctx, &greenhouseapisv1alpha1.TeamMembership{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "TeamMembership", | ||
APIVersion: greenhouseapisv1alpha1.GroupVersion.String(), | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "another-test-membership", | ||
Namespace: test.TestNamespace, | ||
OwnerReferences: []metav1.OwnerReference{ | ||
{ | ||
APIVersion: greenhouseapisv1alpha1.GroupVersion.String(), | ||
Kind: "Team", | ||
Name: anotherTeamName, | ||
UID: "uhuiqweqwe", | ||
}, | ||
}, | ||
}, | ||
Spec: greenhouseapisv1alpha1.TeamMembershipSpec{ | ||
Members: []greenhouseapisv1alpha1.User{ | ||
{ | ||
ID: "d2a72c04-42d2-426a-942d-af9609c4cd00", | ||
FirstName: "Test", | ||
LastName: "User1", | ||
Email: "[email protected]", | ||
}, | ||
{ | ||
ID: "d2a72c04-42d2-426a-942d-af9609c4cd00", | ||
FirstName: "Test", | ||
LastName: "User2", | ||
Email: "[email protected]", | ||
}, | ||
}, | ||
}, | ||
}) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
Eventually(func(g Gomega) { | ||
team := &greenhouseapisv1alpha1.Team{} | ||
err := test.K8sClient.Get(test.Ctx, client.ObjectKey{Name: teamName, Namespace: test.TestNamespace}, team) | ||
|