-
Notifications
You must be signed in to change notification settings - Fork 332
integration: Add test to verify behaviour with offline backends #3501
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
96ab1d0
background-worker: Make push backoff times configurable
akshaymankar 97becbc
brig/getFederationStatus: Always return NonConnectedBackends as empty…
akshaymankar 45c958b
integration: Use separate vHosts for backendA and B.
akshaymankar e4d1967
integration/RunServices: Add hack to make federation work
akshaymankar 4ddb67d
integration: Add test to verify behaviour with offline backends
akshaymankar 93d9d83
regen nix
akshaymankar 542f4dd
Little hack
akshaymankar 3db9c13
helm-var-integration: Workaround bug with federation
akshaymankar de56d22
Integration test: fix asserted status code
54b3587
integration: Assert about down backend conv after down backend is bro…
akshaymankar 370a8e4
integration: Move utility functions in appropriate modules
akshaymankar 6e9c2dd
integration-test.sh: Run new integration test suite first
akshaymankar 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
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
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
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 |
|---|---|---|
|
|
@@ -129,6 +129,12 @@ releases: | |
| value: {{ .Values.federationDomain1 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[0].domain | ||
| value: {{ .Values.federationDomain2 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[2].domain | ||
| value: {{ .Values.dynBackendDomain1 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[3].domain | ||
| value: {{ .Values.dynBackendDomain2 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[4].domain | ||
| value: {{ .Values.dynBackendDomain3 }} | ||
| needs: | ||
| - 'databases-ephemeral' | ||
|
|
||
|
|
@@ -147,5 +153,11 @@ releases: | |
| value: {{ .Values.federationDomain2 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[0].domain | ||
| value: {{ .Values.federationDomain1 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[2].domain | ||
| value: {{ .Values.dynBackendDomain1 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[3].domain | ||
| value: {{ .Values.dynBackendDomain2 }} | ||
| - name: brig.config.optSettings.setFederationDomainConfigs[4].domain | ||
| value: {{ .Values.dynBackendDomain3 }} | ||
|
Comment on lines
+156
to
+161
Contributor
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. ditto. |
||
| needs: | ||
| - 'databases-ephemeral' | ||
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
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
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,72 @@ | ||
| module Notifications where | ||
|
|
||
| import API.Gundeck | ||
| import Control.Monad.Extra | ||
| import Testlib.Prelude | ||
| import UnliftIO.Concurrent | ||
|
|
||
| awaitNotifications :: | ||
| (HasCallStack, MakesValue user, MakesValue client) => | ||
| user -> | ||
| client -> | ||
| Maybe String -> | ||
| -- | Timeout in seconds | ||
| Int -> | ||
| -- | Max no. of notifications | ||
| Int -> | ||
| -- | Selection function. Should not throw any exceptions | ||
| (Value -> App Bool) -> | ||
| App [Value] | ||
| awaitNotifications user client since0 tSecs n selector = | ||
| assertAwaitResult =<< go tSecs since0 (AwaitResult False n [] []) | ||
| where | ||
| go 0 _ res = pure res | ||
| go timeRemaining since res0 = do | ||
| notifs <- bindResponse (getNotifications user client (GetNotifications since Nothing)) $ \resp -> asList (resp.json %. "notifications") | ||
| lastNotifId <- case notifs of | ||
| [] -> pure since | ||
| _ -> Just <$> objId (last notifs) | ||
| (matching, notMatching) <- partitionM selector notifs | ||
| let matchesSoFar = res0.matches <> matching | ||
| res = | ||
| res0 | ||
| { matches = matchesSoFar, | ||
| nonMatches = res0.nonMatches <> notMatching, | ||
| success = length matchesSoFar >= res0.nMatchesExpected | ||
| } | ||
| if res.success | ||
| then pure res | ||
| else do | ||
| threadDelay (1_000_000) | ||
| go (timeRemaining - 1) lastNotifId res | ||
|
|
||
| awaitNotification :: | ||
| (HasCallStack, MakesValue user, MakesValue client, MakesValue lastNotifId) => | ||
| user -> | ||
| client -> | ||
| Maybe lastNotifId -> | ||
| Int -> | ||
| (Value -> App Bool) -> | ||
| App Value | ||
| awaitNotification user client lastNotifId tSecs selector = do | ||
| since0 <- mapM objId lastNotifId | ||
| head <$> awaitNotifications user client since0 tSecs 1 selector | ||
|
|
||
| isDeleteUserNotif :: MakesValue a => a -> App Bool | ||
| isDeleteUserNotif n = | ||
| nPayload n %. "type" `isEqual` "user.delete" | ||
|
|
||
| isNewMessageNotif :: MakesValue a => a -> App Bool | ||
| isNewMessageNotif n = fieldEquals n "payload.0.type" "conversation.otr-message-add" | ||
|
|
||
| isMemberJoinNotif :: MakesValue a => a -> App Bool | ||
| isMemberJoinNotif n = fieldEquals n "payload.0.type" "conversation.member-join" | ||
|
|
||
| isConvLeaveNotif :: MakesValue a => a -> App Bool | ||
| isConvLeaveNotif n = fieldEquals n "payload.0.type" "conversation.member-leave" | ||
|
|
||
| isNotifConv :: (MakesValue conv, MakesValue a) => conv -> a -> App Bool | ||
| isNotifConv conv n = fieldEquals n "payload.0.qualified_conversation" (objQidObject conv) | ||
|
|
||
| isNotifForUser :: (MakesValue user, MakesValue a) => user -> a -> App Bool | ||
| isNotifForUser user n = fieldEquals n "payload.0.data.qualified_user_ids.0" (objQidObject user) |
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
Oops, something went wrong.
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.
I don't understand this, but two lines above the index was 0, and this block starts with 2. Is index 1 skipped on purpose?
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.
In
hack/helm_vars/wire-server/values.yaml.gotmplwe have configured this:Notice how except for the second domain, everything else is placeholders. Here we just replace the placeholders. This is a workaround for this issue: https://wearezeta.atlassian.net/browse/WPB-3796
Eventually we should delete all these explicit search policy stuff.