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

[WPB-5687] more legalhold tests #3966

Merged
merged 21 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions changelog.d/5-internal/WPB-7021
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
port more of the legalhold test-suite from galley-integration to /integration and get rid of the need for startDynamicBackends
1 change: 1 addition & 0 deletions charts/integration/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ data:
stern:
host: stern.wire-federation-v0.svc.cluster.local
port: 8080
integrationTestHostName: integration-headless.{{ .Release.Namespace }}.svc.cluster.local
11 changes: 11 additions & 0 deletions charts/integration/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{{- $newLabels := eq (include "integrationTestHelperNewLabels" .) "true" -}}
---
apiVersion: v1
kind: Service
metadata:
name: integration-headless
spec:
selector:
app: integration-integration
type: ClusterIP
clusterIP: None

---
apiVersion: v1
kind: Service
Expand Down
19 changes: 16 additions & 3 deletions integration/test/Notifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ 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"

isConvLeaveNotifWithLeaver :: (MakesValue user, MakesValue a) => user -> a -> App Bool
isConvLeaveNotifWithLeaver user n =
fieldEquals n "payload.0.type" "conversation.member-leave"
&&~ (n %. "payload.0.data.user_ids.0") `isEqual` (user %. "id")

isNotifConv :: (MakesValue conv, MakesValue a, HasCallStack) => conv -> a -> App Bool
isNotifConv conv n = fieldEquals n "payload.0.qualified_conversation" (objQidObject conv)

Expand Down Expand Up @@ -145,6 +150,12 @@ isConvAccessUpdateNotif n =
isConvCreateNotif :: MakesValue a => a -> App Bool
isConvCreateNotif n = fieldEquals n "payload.0.type" "conversation.create"

-- | like 'isConvCreateNotif' but excludes self conversations
isConvCreateNotifNotSelf :: MakesValue a => a -> App Bool
isConvCreateNotifNotSelf n =
fieldEquals n "payload.0.type" "conversation.create"
&&~ do not <$> fieldEquals n "payload.0.data.access" ["private"]

isConvDeleteNotif :: MakesValue a => a -> App Bool
isConvDeleteNotif n = fieldEquals n "payload.0.type" "conversation.delete"

Expand Down Expand Up @@ -177,9 +188,11 @@ isUserConnectionNotif = notifTypeIsEqual "user.connection"

isConnectionNotif :: MakesValue a => String -> a -> App Bool
isConnectionNotif status n =
(&&)
<$> nPayload n %. "type" `isEqual` "user.connection"
<*> nPayload n %. "connection.status" `isEqual` status
-- NB:
-- (&&) <$> (print "hello" *> pure False) <*> fail "bla" === _|_
-- runMaybeT $ (lift (print "hello") *> MaybeT (pure Nothing)) *> lift (fail "bla") === pure Nothing
nPayload n %. "type" `isEqual` "user.connection"
&&~ nPayload n %. "connection.status" `isEqual` status

assertLeaveNotification ::
( HasCallStack,
Expand Down
4 changes: 2 additions & 2 deletions integration/test/SetupHelpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ setUpLHDevice ::
tid ->
owner ->
uid ->
-- | the port the LH service is running on
Int ->
-- | the host and port the LH service is running on
(String, Int) ->
App ()
setUpLHDevice tid alice bob lhPort = do
legalholdWhitelistTeam tid alice
Expand Down
Loading
Loading