MM-30861: Fix racy test TestSaml2Login (#16376)

* MM-30861: Fix racy test TestSaml2Login

https://mattermost.atlassian.net/browse/MM-30861

```release-note
NONE
```

* incorporate suggestions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-11-25 19:01:32 +05:30
коммит произвёл GitHub
родитель e014de0a65
Коммит faaac9cb74

Просмотреть файл

@@ -117,15 +117,12 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
switch action { switch action {
case model.OAUTH_ACTION_SIGNUP: case model.OAUTH_ACTION_SIGNUP:
teamId := relayProps["team_id"] if teamId := relayProps["team_id"]; teamId != "" {
if len(teamId) > 0 { if err = c.App.AddUserToTeamByTeamId(teamId, user); err != nil {
c.App.Srv().Go(func() { mlog.Error(err.Error())
if err = c.App.AddUserToTeamByTeamId(teamId, user); err != nil { break
mlog.Error(err.Error()) }
} else { c.App.AddDirectChannels(teamId, user)
c.App.AddDirectChannels(teamId, user)
}
})
} }
case model.OAUTH_ACTION_EMAIL_TO_SSO: case model.OAUTH_ACTION_EMAIL_TO_SSO:
if err = c.App.RevokeAllSessions(user.Id); err != nil { if err = c.App.RevokeAllSessions(user.Id); err != nil {