From 47aeca07be23f0378d7b71fca5d71af3dcd7a9b0 Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Wed, 15 Dec 2021 08:29:39 +0000 Subject: [PATCH 1/2] moved integration test BSI tags to top --- services/galley/test/integration/API.hs | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index 801d020109d..f05466f549c 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -366,9 +366,9 @@ postConvWithRemoteUsersOk = do EdConversation c' -> assertConvEquals cnv c' _ -> assertFailure "Unexpected event data" --- | This test verifies whether a message actually gets sent all the way to --- cannon. -- @SF.Separation @TSFI.RESTfulAPI @S2 +-- This test verifies whether a message actually gets sent all the way to +-- cannon. postCryptoMessage1 :: TestM () postCryptoMessage1 = do localDomain <- viewFederationDomain @@ -452,8 +452,8 @@ postCryptoMessage1 = do liftIO $ assertBool "unexpected equal clients" (bc /= bc2) assertNoMsg wsB2 (wsAssertOtr qconv qalice ac bc cipher) --- | This test verifies basic mismatch behaviour of the the JSON endpoint. -- @SF.Separation @TSFI.RESTfulAPI @S2 +-- This test verifies basic mismatch behaviour of the the JSON endpoint. postCryptoMessage2 :: TestM () postCryptoMessage2 = do b <- view tsBrig @@ -478,8 +478,8 @@ postCryptoMessage2 = do Map.keys (userClientMap (getUserClientPrekeyMap p)) @=? [eve] Map.keys <$> Map.lookup eve (userClientMap (getUserClientPrekeyMap p)) @=? Just [ec] --- | This test verifies basic mismatch behaviour of the protobuf endpoint. -- @SF.Separation @TSFI.RESTfulAPI @S2 +-- This test verifies basic mismatch behaviour of the protobuf endpoint. postCryptoMessage3 :: TestM () postCryptoMessage3 = do b <- view tsBrig @@ -521,10 +521,10 @@ postCryptoMessage4 = do postProtoOtrMessage alice (ClientId "172618352518396") conv m !!! const 403 === statusCode --- | This test verifies the following scenario. +-- @SF.Separation @TSFI.RESTfulAPI @S2 +-- This test verifies the following scenario. -- A client sends a message to all clients of a group and one more who is not part of the group. -- The server must not send this message to client ids not part of the group. --- @SF.Separation @TSFI.RESTfulAPI @S2 postMessageClientNotInGroupDoesNotReceiveMsg :: TestM () postMessageClientNotInGroupDoesNotReceiveMsg = do localDomain <- viewFederationDomain @@ -547,9 +547,9 @@ postMessageClientNotInGroupDoesNotReceiveMsg = do checkEveGetsMsg checkChadDoesNotGetMsg --- | This test verifies that when a client sends a message not to all clients of a group then the server should reject the message and sent a notification to the sender (412 Missing clients). --- The test is somewhat redundant because this is already tested as part of other tests already. This is a stand alone test that solely tests the behavior described above. -- @SF.Separation @TSFI.RESTfulAPI @S2 +-- This test verifies that when a client sends a message not to all clients of a group then the server should reject the message and sent a notification to the sender (412 Missing clients). +-- The test is somewhat redundant because this is already tested as part of other tests already. This is a stand alone test that solely tests the behavior described above. postMessageRejectIfMissingClients :: TestM () postMessageRejectIfMissingClients = do (sender, senderClient) : allReceivers <- randomUserWithClient `traverse` someLastPrekeys @@ -575,9 +575,9 @@ postMessageRejectIfMissingClients = do mkMsg :: ByteString -> (UserId, ClientId) -> (UserId, ClientId, Text) mkMsg text (userId, clientId) = (userId, clientId, toBase64Text text) --- | This test verifies behaviour under various values of ignore_missing and --- report_missing. Only tests the JSON endpoint. -- @SF.Separation @TSFI.RESTfulAPI @S2 +-- This test verifies behaviour under various values of ignore_missing and +-- report_missing. Only tests the JSON endpoint. postCryptoMessage5 :: TestM () postCryptoMessage5 = do (alice, ac) <- randomUserWithClient (someLastPrekeys !! 0) @@ -766,10 +766,10 @@ postMessageQualifiedLocalOwningBackendSuccess = do WS.assertMatch_ t wsAlex2 (wsAssertOtr' encodedData convId alice aliceClient alexClient2 encodedTextForAlex2) WS.assertMatch_ t wsAmy (wsAssertOtr' encodedData convId alice aliceClient amyClient encodedTextForAmy) --- | Sets up a conversation on Backend A known as "owning backend". One of the +-- @SF.Separation @TSFI.RESTfulAPI @S2 +-- Sets up a conversation on Backend A known as "owning backend". One of the -- users from Backend A will send the message but have a missing client. It is -- expected that the message will not be sent. --- @SF.Separation @TSFI.RESTfulAPI @S2 postMessageQualifiedLocalOwningBackendMissingClients :: TestM () postMessageQualifiedLocalOwningBackendMissingClients = do -- Cannon for local users @@ -925,11 +925,11 @@ postMessageQualifiedLocalOwningBackendRedundantAndDeletedClients = do -- Wait less for no message WS.assertNoEvent (1 # Second) [wsNonMember] --- | Sets up a conversation on Backend A known as "owning backend". One of the +-- @SF.Separation @TSFI.RESTfulAPI @S2 +-- Sets up a conversation on Backend A known as "owning backend". One of the -- users from Backend A will send the message but have a missing client. It is -- expected that the message will be sent except when it is specifically -- requested to report on missing clients of a user. --- @SF.Separation @TSFI.RESTfulAPI @S2 postMessageQualifiedLocalOwningBackendIgnoreMissingClients :: TestM () postMessageQualifiedLocalOwningBackendIgnoreMissingClients = do -- WS receive timeout From 369576ffd1b1f37b24ba639292c1659ec88aee7c Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Wed, 15 Dec 2021 12:47:01 +0000 Subject: [PATCH 2/2] naming --- services/galley/test/integration/API.hs | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/services/galley/test/integration/API.hs b/services/galley/test/integration/API.hs index f05466f549c..0186f3448d8 100644 --- a/services/galley/test/integration/API.hs +++ b/services/galley/test/integration/API.hs @@ -199,11 +199,11 @@ tests s = test s "conversation receipt mode update with remote members" putReceiptModeWithRemotesOk, test s "send typing indicators" postTypingIndicators, test s "leave connect conversation" leaveConnectConversation, - test s "post conversations/:cnv/otr/message: message delivery and missing clients" postCryptoMessage1, - test s "post conversations/:cnv/otr/message: mismatch and prekey fetching" postCryptoMessage2, - test s "post conversations/:cnv/otr/message: mismatch with protobuf" postCryptoMessage3, - test s "post conversations/:cnv/otr/message: unknown sender client" postCryptoMessage4, - test s "post conversations/:cnv/otr/message: ignore_missing and report_missing" postCryptoMessage5, + test s "post conversations/:cnv/otr/message: message delivery and missing clients" postCryptoMessageVerifyMsgSentAndRejectIfMissingClient, + test s "post conversations/:cnv/otr/message: mismatch and prekey fetching" postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysJson, + test s "post conversations/:cnv/otr/message: mismatch with protobuf" postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysProto, + test s "post conversations/:cnv/otr/message: unknown sender client" postCryptoMessageNotAuthorizeUnknownClient, + test s "post conversations/:cnv/otr/message: ignore_missing and report_missing" postCryptoMessageVerifyCorrectResponseIfIgnoreAndReportMissingQueryParam, test s "post message qualified - local owning backend - success" postMessageQualifiedLocalOwningBackendSuccess, test s "post message qualified - local owning backend - missing clients" postMessageQualifiedLocalOwningBackendMissingClients, test s "post message qualified - local owning backend - redundant and deleted clients" postMessageQualifiedLocalOwningBackendRedundantAndDeletedClients, @@ -369,8 +369,8 @@ postConvWithRemoteUsersOk = do -- @SF.Separation @TSFI.RESTfulAPI @S2 -- This test verifies whether a message actually gets sent all the way to -- cannon. -postCryptoMessage1 :: TestM () -postCryptoMessage1 = do +postCryptoMessageVerifyMsgSentAndRejectIfMissingClient :: TestM () +postCryptoMessageVerifyMsgSentAndRejectIfMissingClient = do localDomain <- viewFederationDomain c <- view tsCannon (alice, ac) <- randomUserWithClient (someLastPrekeys !! 0) @@ -453,9 +453,9 @@ postCryptoMessage1 = do assertNoMsg wsB2 (wsAssertOtr qconv qalice ac bc cipher) -- @SF.Separation @TSFI.RESTfulAPI @S2 --- This test verifies basic mismatch behaviour of the the JSON endpoint. -postCryptoMessage2 :: TestM () -postCryptoMessage2 = do +-- This test verifies basic mismatch behavior of the the JSON endpoint. +postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysJson :: TestM () +postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysJson = do b <- view tsBrig (alice, ac) <- randomUserWithClient (someLastPrekeys !! 0) (bob, bc) <- randomUserWithClient (someLastPrekeys !! 1) @@ -480,8 +480,8 @@ postCryptoMessage2 = do -- @SF.Separation @TSFI.RESTfulAPI @S2 -- This test verifies basic mismatch behaviour of the protobuf endpoint. -postCryptoMessage3 :: TestM () -postCryptoMessage3 = do +postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysProto :: TestM () +postCryptoMessageVerifyRejectMissingClientAndRepondMissingPrekeysProto = do b <- view tsBrig (alice, ac) <- randomUserWithClient (someLastPrekeys !! 0) (bob, bc) <- randomUserWithClient (someLastPrekeys !! 1) @@ -508,8 +508,8 @@ postCryptoMessage3 = do -- | This test verifies behaviour when an unknown client posts the message. Only -- tests the Protobuf endpoint. -postCryptoMessage4 :: TestM () -postCryptoMessage4 = do +postCryptoMessageNotAuthorizeUnknownClient :: TestM () +postCryptoMessageNotAuthorizeUnknownClient = do alice <- randomUser bob <- randomUser bc <- randomClient bob (someLastPrekeys !! 0) @@ -578,8 +578,8 @@ postMessageRejectIfMissingClients = do -- @SF.Separation @TSFI.RESTfulAPI @S2 -- This test verifies behaviour under various values of ignore_missing and -- report_missing. Only tests the JSON endpoint. -postCryptoMessage5 :: TestM () -postCryptoMessage5 = do +postCryptoMessageVerifyCorrectResponseIfIgnoreAndReportMissingQueryParam :: TestM () +postCryptoMessageVerifyCorrectResponseIfIgnoreAndReportMissingQueryParam = do (alice, ac) <- randomUserWithClient (someLastPrekeys !! 0) (bob, bc) <- randomUserWithClient (someLastPrekeys !! 1) (chad, cc) <- randomUserWithClient (someLastPrekeys !! 2)