Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve flaky integration tests #1333

Merged
merged 2 commits into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions services/brig/test/integration/API/Search.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Data.Aeson (FromJSON, Value, (.=))
import qualified Data.Aeson as Aeson
import Data.Handle (fromHandle)
import Data.Id
import Data.String.Conversions (cs)
import qualified Data.Text as Text
import qualified Database.Bloodhound as ES
import qualified Galley.Types.Teams.SearchVisibility as Team
Expand Down Expand Up @@ -213,11 +214,13 @@ testOrderHandle brig = do
handlePrefixMatch <- userId <$> createUser' True "handle prefix match" brig
void $ putHandle brig handlePrefixMatch (searchedWord <> "suffix")
refreshIndex brig
resultUIds <- map contactUserId . searchResults <$> executeSearch brig searcher searchedWord
results <- searchResults <$> executeSearch brig searcher searchedWord
let resultUIds = map contactUserId results
let expectedOrder = [handleMatch, handlePrefixMatch]
let dbg = "results: " <> show results <> "\nsearchedWord: " <> cs searchedWord
liftIO $
assertEqual
"Expected order: handle match, handle prefix match"
("Expected order: handle match, handle prefix match.\n\nSince this test fails sporadically for unknown reasons here here is some debug info:\n" <> dbg)
expectedOrder
resultUIds

Expand Down
4 changes: 2 additions & 2 deletions services/spar/test-integration/Test/Spar/Scim/UserSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ testCreateUserTimeout = do

waitUserExpiration
searchUser tok scimUser email False
aFewTimesRecover $ registerInvitation email userName inviteeCode False
registerInvitation email userName inviteeCode False
searchUser tok scimUser email False

(scimStoredUser2, _inv, inviteeCode2) <- createUser'step tok tid scimUser email
Expand Down Expand Up @@ -680,7 +680,7 @@ testCreateUserTimeout = do
waitUserExpiration = do
timeoutSecs <- asks $ fromMaybe 5 . brigSettingsTeamInvitationTimeout . _teOpts
Control.Exception.assert (timeoutSecs < 30) $ do
threadDelay $ (timeoutSecs + 1) * 1_000_000
threadDelay $ (timeoutSecs + 2) * 1_000_000

----------------------------------------------------------------------------
-- Listing users
Expand Down