-
Notifications
You must be signed in to change notification settings - Fork 332
Add some retry delay logic to Search integration tests to hopefully deflake them #1774
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Attempt to deflake a flaky integration test about search |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -263,15 +263,15 @@ testOrderName brig = do | |
| nameMatch <- userQualifiedId <$> createUser' True searchedWord brig | ||
| namePrefixMatch <- userQualifiedId <$> createUser' True (searchedWord <> "suffix") brig | ||
| refreshIndex brig | ||
| results <- searchResults <$> executeSearch brig searcher searchedWord | ||
| let resultUIds = map contactQualifiedId results | ||
| let expectedOrder = [nameMatch, namePrefixMatch] | ||
| let dbg = "results: " <> show results <> "\nsearchedWord: " <> cs searchedWord | ||
| -- possibly there is some delay in refreshing of the index writes being | ||
| -- visible for subsequent reads, so we try this a few times. | ||
| results <- aFewTimes 12 (toIds <$> executeSearch brig searcher searchedWord) (== expectedOrder) | ||
| liftIO $ | ||
| assertEqual | ||
| ("Expected order: name match, name prefix match.\n\nSince this test fails sporadically for unknown reasons here is some debug info:\n" <> dbg) | ||
| "If this test fails again, maybe we should consider deleting it and living with some more uncertainty" | ||
| expectedOrder | ||
| resultUIds | ||
| results | ||
|
|
||
| testOrderHandle :: TestConstraints m => Brig -> m () | ||
| testOrderHandle brig = do | ||
|
|
@@ -282,15 +282,18 @@ testOrderHandle brig = do | |
| handlePrefixMatch <- userQualifiedId <$> createUser' True "handle prefix match" brig | ||
| void $ putHandle brig (qUnqualified handlePrefixMatch) (searchedWord <> "suffix") | ||
| refreshIndex brig | ||
| results <- searchResults <$> executeSearch brig searcher searchedWord | ||
| let resultUIds = map contactQualifiedId results | ||
| let expectedOrder = [handleMatch, handlePrefixMatch] | ||
| let dbg = "results: " <> show results <> "\nsearchedWord: " <> cs searchedWord | ||
| -- possibly there is some delay in refreshing of the index writes being | ||
| -- visible for subsequent reads, so we try this a few times. | ||
| results <- aFewTimes 12 (toIds <$> executeSearch brig searcher searchedWord) (== expectedOrder) | ||
| liftIO $ | ||
| assertEqual | ||
| ("Expected order: handle match, handle prefix match.\n\nSince this test fails sporadically for unknown reasons here here is some debug info:\n" <> dbg) | ||
| "If this test fails again, maybe we should consider deleting it and living with some more uncertainty" | ||
| expectedOrder | ||
| resultUIds | ||
| results | ||
|
Comment on lines
-285
to
+293
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is not broken anymore. The comment is stale. |
||
|
|
||
| toIds :: SearchResult Contact -> [Qualified UserId] | ||
| toIds = map contactQualifiedId . searchResults | ||
|
|
||
| testSearchTeamMemberAsNonMemberDisplayName :: TestConstraints m => Brig -> m () | ||
| testSearchTeamMemberAsNonMemberDisplayName brig = do | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't actually fix the test. The problem is in the production code. So, if you really want to fix it by running again, you should generate the name again.