mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
Fix flaky tests about notifying changes
This commit is contained in:
@ -107,12 +107,16 @@ func (mocks *mocksForStore) newStoreNoEvents(combinedMode bool, msgs ...*pmapi.M
|
||||
mocks.client.EXPECT().CountMessages("")
|
||||
|
||||
// Call to get latest event ID and then to process first event.
|
||||
eventAfterSyncRequested := make(chan struct{})
|
||||
mocks.client.EXPECT().GetEvent("").Return(&pmapi.Event{
|
||||
EventID: "firstEventID",
|
||||
}, nil)
|
||||
mocks.client.EXPECT().GetEvent("firstEventID").Return(&pmapi.Event{
|
||||
EventID: "latestEventID",
|
||||
}, nil)
|
||||
mocks.client.EXPECT().GetEvent("firstEventID").DoAndReturn(func(_ string) (*pmapi.Event, error) {
|
||||
close(eventAfterSyncRequested)
|
||||
return &pmapi.Event{
|
||||
EventID: "latestEventID",
|
||||
}, nil
|
||||
})
|
||||
|
||||
mocks.client.EXPECT().ListMessages(gomock.Any()).Return(msgs, len(msgs), nil).AnyTimes()
|
||||
for _, msg := range msgs {
|
||||
@ -131,6 +135,14 @@ func (mocks *mocksForStore) newStoreNoEvents(combinedMode bool, msgs ...*pmapi.M
|
||||
require.NoError(mocks.tb, err)
|
||||
|
||||
// We want to wait until first sync has finished.
|
||||
// Checking that event after sync was reuested is not the best way to
|
||||
// do the check, because sync could take more time, but sync is going
|
||||
// in background and if there is no message to wait for, we don't have
|
||||
// anything better.
|
||||
select {
|
||||
case <-eventAfterSyncRequested:
|
||||
case <-time.After(5 * time.Second):
|
||||
}
|
||||
require.Eventually(mocks.tb, func() bool {
|
||||
for _, msg := range msgs {
|
||||
_, err := mocks.store.getMessageFromDB(msg.ID)
|
||||
|
||||
@ -31,6 +31,14 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
||||
### Removed
|
||||
* GODT-208 Remove deprecated use of BuildNameToCertificate.
|
||||
|
||||
### Fixed
|
||||
* GODT-922 Fix panic during restarting the bridge.
|
||||
* GODT-945 Fix panic in integration tests caused by concurrent map writes.
|
||||
* GODT-732 Fix usage of fontawesome.
|
||||
* GODT-951 Properly parse message with long lines in header and long header split to multiple lines (upgrading to latest go-message).
|
||||
* GODT-894 Fix panic when sending while account is logging in.
|
||||
* GODT-946 Fix flaky tests notifying changes.
|
||||
|
||||
### Changed
|
||||
* GODT-97 Don't log errors caused by SELECT "".
|
||||
|
||||
|
||||
Reference in New Issue
Block a user