Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix teams synced as top-level organization #59

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controllers/team_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func buildTeamKeycloakGroup(team *controlv1.Team) keycloak.Group {
groupMem = append(groupMem, u.Name)
}

return keycloak.NewGroup(team.Namespace, team.Name).WithMemberNames(groupMem...)
return keycloak.NewGroup(team.Spec.DisplayName, team.Namespace, team.Name).WithMemberNames(groupMem...)
}

// SetupWithManager sets up the controller with the Manager.
Expand Down
6 changes: 3 additions & 3 deletions controllers/team_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func Test_TeamController_Reconcile_Success(t *testing.T) {
ctx := context.Background()

c, keyMock, _ := prepareTest(t, barTeam)
group := keycloak.NewGroup(barTeam.Namespace, barTeam.Name).WithMemberNames("baz", "qux")
group := keycloak.NewGroup(barTeam.Spec.DisplayName, barTeam.Namespace, barTeam.Name).WithMemberNames("baz", "qux")
keyMock.EXPECT().
PutGroup(gomock.Any(), group).
Return(group, nil).
Expand Down Expand Up @@ -50,7 +50,7 @@ func Test_TeamController_Reconcile_Failure(t *testing.T) {
ctx := context.Background()

c, keyMock, erMock := prepareTest(t, barTeam)
group := keycloak.NewGroup(barTeam.Namespace, barTeam.Name).WithMemberNames("baz", "qux")
group := keycloak.NewGroup(barTeam.Spec.DisplayName, barTeam.Namespace, barTeam.Name).WithMemberNames("baz", "qux")
keyMock.EXPECT().
PutGroup(gomock.Any(), group).
Return(keycloak.Group{}, errors.New("create failed")).
Expand Down Expand Up @@ -83,7 +83,7 @@ func Test_TeamController_Reconcile_Member_Failure(t *testing.T) {
ctx := context.Background()

c, keyMock, erMock := prepareTest(t, barTeam)
group := keycloak.NewGroup(barTeam.Namespace, barTeam.Name).WithMemberNames("baz", "qux")
group := keycloak.NewGroup(barTeam.Spec.DisplayName, barTeam.Namespace, barTeam.Name).WithMemberNames("baz", "qux")
keyMock.EXPECT().
PutGroup(gomock.Any(), group).
Return(keycloak.Group{}, &keycloak.MembershipSyncErrors{
Expand Down