Skip to content

Commit

Permalink
fix(pam/gdmmodel): Forward public AuthModeSelected to GDM (#631)
Browse files Browse the repository at this point in the history
authModeSelected event we were listening to is an event that may be
ignored or adjusted depending on authModeSelection model logic, so it's
what we should also expose to GDM.

We couldn't do that though since the event wasn't forwarded, so do it.

Also simplify user selection on GDM tests, by mimicking more what we
really do.

It should help with flacky tests such as [1].

[1]
https://github.com/ubuntu/authd/actions/runs/11802896113/job/32879602555?pr=583
  • Loading branch information
3v1n0 authored Nov 13, 2024
2 parents 93d8d06 + 75bdc48 commit 7e8299d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 177 deletions.
8 changes: 3 additions & 5 deletions pam/internal/adapter/gdmmodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ func (m *gdmModel) pollGdm() tea.Cmd {
for _, result := range gdmPollResults {
switch res := result.Data.(type) {
case *gdm.EventData_UserSelected:
commands = append(commands, sendEvent(userSelected{
username: res.UserSelected.UserId,
}))
commands = append(commands, sendUserSelected(res.UserSelected.UserId))

case *gdm.EventData_BrokerSelected:
if res.BrokerSelected == nil {
Expand Down Expand Up @@ -217,9 +215,9 @@ func (m gdmModel) Update(msg tea.Msg) (gdmModel, tea.Cmd) {
AuthModesReceived: &gdm.Events_AuthModesReceived{AuthModes: msg.authModes},
})

case authModeSelected:
case AuthModeSelected:
return m, m.emitEvent(&gdm.EventData_AuthModeSelected{
AuthModeSelected: &gdm.Events_AuthModeSelected{AuthModeId: msg.id},
AuthModeSelected: &gdm.Events_AuthModeSelected{AuthModeId: msg.ID},
})

case UILayoutReceived:
Expand Down
Loading

0 comments on commit 7e8299d

Please sign in to comment.