test: Verify leaks at end of WithEnv

Helps track down the individual test leaks.
This commit is contained in:
Leander Beernaert
2023-07-28 14:51:08 +02:00
parent 86bde91958
commit 32448063dc

View File

@ -211,13 +211,19 @@ func (s *scenario) bridgeSendsAnAddressDeletedEventForUser(username string) erro
} }
func (s *scenario) bridgeSendsSyncStartedAndFinishedEventsForUser(username string) error { func (s *scenario) bridgeSendsSyncStartedAndFinishedEventsForUser(username string) error {
wantUserID := s.t.getUserByName(username).getUserID()
for {
startEvent, ok := awaitType(s.t.events, events.SyncStarted{}, 30*time.Second) startEvent, ok := awaitType(s.t.events, events.SyncStarted{}, 30*time.Second)
if !ok { if !ok {
return errors.New("expected sync started event, got none") return errors.New("expected sync started event, got none")
} }
if wantUserID := s.t.getUserByName(username).getUserID(); startEvent.UserID != wantUserID { // There can be multiple sync events, and some might not be for this user
return fmt.Errorf("expected sync started event for user %s, got %s", wantUserID, startEvent.UserID) if startEvent.UserID != wantUserID {
continue
}
break
} }
finishEvent, ok := awaitType(s.t.events, events.SyncFinished{}, 30*time.Second) finishEvent, ok := awaitType(s.t.events, events.SyncFinished{}, 30*time.Second)