test: fix flaky tests.
This commit is contained in:
@ -332,8 +332,10 @@ func (s *scenario) drafAtIndexWasMovedToTrashForAddressOfAccount(draftIndex int,
|
||||
}
|
||||
|
||||
func (s *scenario) userLogsInWithUsernameAndPassword(username, password string) error {
|
||||
evtCh, cancel := s.t.bridge.GetEvents(events.SMTPServerReady{})
|
||||
defer cancel()
|
||||
smtpEvtCh, cancelSMTP := s.t.bridge.GetEvents(events.SMTPServerReady{})
|
||||
defer cancelSMTP()
|
||||
imapEvtCh, cancelIMAP := s.t.bridge.GetEvents(events.IMAPServerReady{})
|
||||
defer cancelIMAP()
|
||||
|
||||
userID, err := s.t.bridge.LoginFull(context.Background(), username, []byte(password), nil, nil)
|
||||
if err != nil {
|
||||
@ -342,9 +344,13 @@ func (s *scenario) userLogsInWithUsernameAndPassword(username, password string)
|
||||
// We need to wait for server to be up or we won't be able to connect. It should only happen once to avoid
|
||||
// blocking on multiple Logins.
|
||||
if !s.t.imapServerStarted {
|
||||
<-evtCh
|
||||
<-imapEvtCh
|
||||
s.t.imapServerStarted = true
|
||||
}
|
||||
if !s.t.smtpServerStarted {
|
||||
<-smtpEvtCh
|
||||
s.t.smtpServerStarted = true
|
||||
}
|
||||
|
||||
if userID != s.t.getUserByName(username).getUserID() {
|
||||
return errors.New("user ID mismatch")
|
||||
|
||||
Reference in New Issue
Block a user