diff --git a/Changelog.md b/Changelog.md index f3d94a6f..15176672 100644 --- a/Changelog.md +++ b/Changelog.md @@ -39,6 +39,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) * Ensure DoH is used at startup to load users for the initial auth. * Issue causing deadlock when reloading users keys due to double-locking of a mutex. * Correctly handle failure to unlock single key. +* GODT-479 Fix flaky integration tests. ## [v1.2.7] Donghai-hotfix - beta (2020-05-07) diff --git a/internal/store/store_test_exports.go b/internal/store/store_test_exports.go index 23462bbe..ac4ff232 100644 --- a/internal/store/store_test_exports.go +++ b/internal/store/store_test_exports.go @@ -28,6 +28,17 @@ import ( // TestSync triggers a sync of the store. func (store *Store) TestSync() { + store.lock.Lock() + defer store.lock.Unlock() + + // Sync can happen any time. Sync assigns sequence numbers and UIDs + // in the order of fetching from the server. We expect in the test + // that sequence numbers and UIDs are assigned in the same order as + // written in scenario setup. With more than one sync that cannot + // be guaranteed so once test calls this function, first it has to + // delete previous any already synced sequence numbers and UIDs. + _ = store.truncateMailboxesBucket() + store.triggerSync() }