Skip to content
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
1 change: 1 addition & 0 deletions changelog.d/6-federation/fix-mls-client-assertions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix assertion in testWelcomeNoKey
22 changes: 4 additions & 18 deletions services/galley/test/integration/API/MLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ tests s =
[ testGroup
"Welcome"
[ test s "local welcome" testLocalWelcome,
test s "local welcome (client with no public key)" testWelcomeNoKey,
test s "local welcome (client with no public key)" testWelcomeUnknownClient
test s "local welcome (client with no public key)" testWelcomeNoKey
],
testGroup
"Creation"
Expand Down Expand Up @@ -145,23 +144,10 @@ testWelcomeNoKey = do
. paths ["mls", "welcome"]
. zUser (qUnqualified (pUserId creator))
. content "message/mls"
. zConn "conn"
. bytes welcome
)
!!! const 400 === statusCode

testWelcomeUnknownClient :: TestM ()
testWelcomeUnknownClient = do
MessagingSetup {..} <- aliceInvitesBob 1 def {createClients = DontCreateClients}

galley <- viewGalley
post
( galley
. paths ["mls", "welcome"]
. zUser (qUnqualified (pUserId creator))
. content "message/mls"
. bytes welcome
)
!!! const 400 === statusCode
!!! const 404 === statusCode

-- | Send a commit message, and assert that all participants see an event with
-- the given list of new members.
Expand Down Expand Up @@ -264,7 +250,7 @@ testAddUserWithProteusClients = do
participants@(_, [bob]) <- setupParticipants tmp def [2]

-- and a non-MLS client
void $ takeLastPrekey >>= lift . addClient (pUserId bob)
void $ takeLastPrekey >>= lift . randomClient (qUnqualified (pUserId bob))

pure participants

Expand Down
23 changes: 3 additions & 20 deletions services/galley/test/integration/API/MLS/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Imports
import System.FilePath
import System.IO.Temp
import System.Process
import Test.QuickCheck (arbitrary, generate)
import Test.Tasty.HUnit
import TestSetup
import Wire.API.Conversation
Expand Down Expand Up @@ -109,8 +110,8 @@ setupUserClient tmp doCreateClients usr = do
lift $ do
-- create client if requested
c <- case doCreateClients of
DontCreateClients -> randomClient (qUnqualified usr) lpk
_ -> addClient usr lpk
DontCreateClients -> liftIO $ generate arbitrary
_ -> randomClient (qUnqualified usr) lpk

let qcid =
show (qUnqualified usr)
Expand Down Expand Up @@ -235,24 +236,6 @@ aliceInvitesBob numBobClients opts@SetupOptions {..} = withSystemTempDirectory "
..
}

addClient :: HasCallStack => Qualified UserId -> LastPrekey -> TestM ClientId
addClient u lpk = do
let new = newClient PermanentClientType lpk

brig <- view tsBrig
c <-
responseJsonError
=<< post
( brig
. paths ["i", "clients", toByteString' (qUnqualified u)]
. zConn "conn"
. queryItem "skip_reauth" "true"
. json new
)
<!! const 201 === statusCode

pure (clientId c)

addKeyPackage :: HasCallStack => Qualified UserId -> ClientId -> RawMLS KeyPackage -> TestM ()
addKeyPackage u c kp = do
let update = defUpdateClient {updateClientMLSPublicKeys = Map.singleton Ed25519 (bcSignatureKey (kpCredential (rmValue kp)))}
Expand Down
7 changes: 6 additions & 1 deletion services/galley/test/integration/API/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,12 @@ randomClientWithCaps :: HasCallStack => UserId -> LastPrekey -> Maybe (Set Clien
randomClientWithCaps uid lk caps = do
b <- view tsBrig
resp <-
post (b . paths ["i", "clients", toByteString' uid] . json newClientBody)
post
( b
. paths ["i", "clients", toByteString' uid]
. queryItem "skip_reauth" "true"
. json newClientBody
)
<!! const rStatus === statusCode
client <- responseJsonError resp
return (clientId client)
Expand Down