diff --git a/changelog.d/6-federation/fix-mls-client-assertions b/changelog.d/6-federation/fix-mls-client-assertions new file mode 100644 index 00000000000..a86074bff84 --- /dev/null +++ b/changelog.d/6-federation/fix-mls-client-assertions @@ -0,0 +1 @@ +Fix assertion in testWelcomeNoKey diff --git a/services/galley/test/integration/API/MLS.hs b/services/galley/test/integration/API/MLS.hs index 39eb06605d4..dcc30d9c503 100644 --- a/services/galley/test/integration/API/MLS.hs +++ b/services/galley/test/integration/API/MLS.hs @@ -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" @@ -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. @@ -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 diff --git a/services/galley/test/integration/API/MLS/Util.hs b/services/galley/test/integration/API/MLS/Util.hs index a34847971f3..25b2fade389 100644 --- a/services/galley/test/integration/API/MLS/Util.hs +++ b/services/galley/test/integration/API/MLS/Util.hs @@ -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 @@ -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) @@ -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 - ) - Qualified UserId -> ClientId -> RawMLS KeyPackage -> TestM () addKeyPackage u c kp = do let update = defUpdateClient {updateClientMLSPublicKeys = Map.singleton Ed25519 (bcSignatureKey (kpCredential (rmValue kp)))} diff --git a/services/galley/test/integration/API/Util.hs b/services/galley/test/integration/API/Util.hs index c65997d6104..f72eb36c8e6 100644 --- a/services/galley/test/integration/API/Util.hs +++ b/services/galley/test/integration/API/Util.hs @@ -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 + )