|
|
|
@@ -257,11 +257,11 @@ functionalAPITests :: ATransport -> Spec
|
|
|
|
|
functionalAPITests t = do
|
|
|
|
|
describe "Establishing duplex connection" $ do
|
|
|
|
|
testMatrix2 t runAgentClientTest
|
|
|
|
|
it "should connect when server with multiple identities is stored" $
|
|
|
|
|
xit "should connect when server with multiple identities is stored" $
|
|
|
|
|
withSmpServer t testServerMultipleIdentities
|
|
|
|
|
it "should connect with two peers" $
|
|
|
|
|
xit "should connect with two peers" $
|
|
|
|
|
withSmpServer t testAgentClient3
|
|
|
|
|
it "should establish connection without PQ encryption and enable it" $
|
|
|
|
|
xit "should establish connection without PQ encryption and enable it" $
|
|
|
|
|
withSmpServer t testEnablePQEncryption
|
|
|
|
|
describe "Establishing duplex connection, different PQ settings" $ do
|
|
|
|
|
testPQMatrix2 t $ runAgentClientTestPQ True
|
|
|
|
@@ -290,43 +290,43 @@ functionalAPITests t = do
|
|
|
|
|
testAllowConnectionClientRestart t
|
|
|
|
|
describe "Message delivery" $ do
|
|
|
|
|
describe "update connection agent version on received messages" $ do
|
|
|
|
|
it "should increase if compatible, shouldn't decrease" $
|
|
|
|
|
xit "should increase if compatible, shouldn't decrease" $
|
|
|
|
|
testIncreaseConnAgentVersion t
|
|
|
|
|
it "should increase to max compatible version" $
|
|
|
|
|
xit "should increase to max compatible version" $
|
|
|
|
|
testIncreaseConnAgentVersionMaxCompatible t
|
|
|
|
|
it "should increase when connection was negotiated on different versions" $
|
|
|
|
|
xit "should increase when connection was negotiated on different versions" $
|
|
|
|
|
testIncreaseConnAgentVersionStartDifferentVersion t
|
|
|
|
|
-- TODO PQ tests for upgrading connection to PQ encryption
|
|
|
|
|
it "should deliver message after client restart" $
|
|
|
|
|
xit "should deliver message after client restart" $
|
|
|
|
|
testDeliverClientRestart t
|
|
|
|
|
it "should deliver messages to the user once, even if repeat delivery is made by the server (no ACK)" $
|
|
|
|
|
xit "should deliver messages to the user once, even if repeat delivery is made by the server (no ACK)" $
|
|
|
|
|
testDuplicateMessage t
|
|
|
|
|
it "should report error via msg integrity on skipped messages" $
|
|
|
|
|
xit "should report error via msg integrity on skipped messages" $
|
|
|
|
|
testSkippedMessages t
|
|
|
|
|
it "should connect to the server when server goes up if it initially was down" $
|
|
|
|
|
xit "should connect to the server when server goes up if it initially was down" $
|
|
|
|
|
testDeliveryAfterSubscriptionError t
|
|
|
|
|
it "should deliver messages if one of connections has quota exceeded" $
|
|
|
|
|
xit "should deliver messages if one of connections has quota exceeded" $
|
|
|
|
|
testMsgDeliveryQuotaExceeded t
|
|
|
|
|
describe "message expiration" $ do
|
|
|
|
|
it "should expire one message" $ testExpireMessage t
|
|
|
|
|
it "should expire multiple messages" $ testExpireManyMessages t
|
|
|
|
|
it "should expire one message if quota is exceeded" $ testExpireMessageQuota t
|
|
|
|
|
it "should expire multiple messages if quota is exceeded" $ testExpireManyMessagesQuota t
|
|
|
|
|
xit "should expire one message" $ testExpireMessage t
|
|
|
|
|
xit "should expire multiple messages" $ testExpireManyMessages t
|
|
|
|
|
xit "should expire one message if quota is exceeded" $ testExpireMessageQuota t
|
|
|
|
|
xit "should expire multiple messages if quota is exceeded" $ testExpireManyMessagesQuota t
|
|
|
|
|
describe "Ratchet synchronization" $ do
|
|
|
|
|
it "should report ratchet de-synchronization, synchronize ratchets" $
|
|
|
|
|
xit "should report ratchet de-synchronization, synchronize ratchets" $
|
|
|
|
|
testRatchetSync t
|
|
|
|
|
it "should synchronize ratchets after server being offline" $
|
|
|
|
|
xit "should synchronize ratchets after server being offline" $
|
|
|
|
|
testRatchetSyncServerOffline t
|
|
|
|
|
it "should synchronize ratchets after client restart" $
|
|
|
|
|
xit "should synchronize ratchets after client restart" $
|
|
|
|
|
testRatchetSyncClientRestart t
|
|
|
|
|
it "should synchronize ratchets after suspend/foreground" $
|
|
|
|
|
xit "should synchronize ratchets after suspend/foreground" $
|
|
|
|
|
testRatchetSyncSuspendForeground t
|
|
|
|
|
it "should synchronize ratchets when clients start synchronization simultaneously" $
|
|
|
|
|
xit "should synchronize ratchets when clients start synchronization simultaneously" $
|
|
|
|
|
testRatchetSyncSimultaneous t
|
|
|
|
|
describe "Subscription mode OnlyCreate" $ do
|
|
|
|
|
it "messages delivered only when polled (v8 - slow handshake)" $
|
|
|
|
|
withSmpServer t testOnlyCreatePullSlowHandshake
|
|
|
|
|
it "messages delivered only when polled" $
|
|
|
|
|
xit "messages delivered only when polled" $
|
|
|
|
|
withSmpServer t testOnlyCreatePull
|
|
|
|
|
describe "Inactive client disconnection" $ do
|
|
|
|
|
it "should disconnect clients without subs if they were inactive longer than TTL" $
|
|
|
|
@@ -336,14 +336,14 @@ functionalAPITests t = do
|
|
|
|
|
it "should NOT disconnect active clients" $
|
|
|
|
|
testActiveClientNotDisconnected t
|
|
|
|
|
describe "Suspending agent" $ do
|
|
|
|
|
it "should update client when agent is suspended" $
|
|
|
|
|
xit "should update client when agent is suspended" $
|
|
|
|
|
withSmpServer t testSuspendingAgent
|
|
|
|
|
it "should complete sending messages when agent is suspended" $
|
|
|
|
|
xit "should complete sending messages when agent is suspended" $
|
|
|
|
|
testSuspendingAgentCompleteSending t
|
|
|
|
|
it "should suspend agent on timeout, even if pending messages not sent" $
|
|
|
|
|
xit "should suspend agent on timeout, even if pending messages not sent" $
|
|
|
|
|
testSuspendingAgentTimeout t
|
|
|
|
|
describe "Batching SMP commands" $ do
|
|
|
|
|
it "should subscribe to multiple (200) subscriptions with batching" $
|
|
|
|
|
xit "should subscribe to multiple (200) subscriptions with batching" $
|
|
|
|
|
testBatchedSubscriptions 200 10 t
|
|
|
|
|
skip "faster version of the previous test (200 subscriptions gets very slow with test coverage)" $
|
|
|
|
|
it "should subscribe to multiple (6) subscriptions with batching" $
|
|
|
|
@@ -362,7 +362,7 @@ functionalAPITests t = do
|
|
|
|
|
testDeleteConnectionAsync t
|
|
|
|
|
it "join connection when reply queue creation fails (v8 - slow handshake)" $
|
|
|
|
|
testJoinConnectionAsyncReplyErrorV8 t
|
|
|
|
|
it "join connection when reply queue creation fails" $
|
|
|
|
|
xit "join connection when reply queue creation fails" $
|
|
|
|
|
testJoinConnectionAsyncReplyError t
|
|
|
|
|
describe "delete connection waiting for delivery" $ do
|
|
|
|
|
it "should delete connection immediately if there are no pending messages" $
|
|
|
|
@@ -376,34 +376,34 @@ functionalAPITests t = do
|
|
|
|
|
it "should delete connection by timeout, message in progress can be delivered" $
|
|
|
|
|
testWaitDeliveryTimeout2 t
|
|
|
|
|
describe "Users" $ do
|
|
|
|
|
it "should create and delete user with connections" $
|
|
|
|
|
xit "should create and delete user with connections" $
|
|
|
|
|
withSmpServer t testUsers
|
|
|
|
|
it "should create and delete user without connections" $
|
|
|
|
|
xit "should create and delete user without connections" $
|
|
|
|
|
withSmpServer t testDeleteUserQuietly
|
|
|
|
|
it "should create and delete user with connections when server connection fails" $
|
|
|
|
|
xit "should create and delete user with connections when server connection fails" $
|
|
|
|
|
testUsersNoServer t
|
|
|
|
|
it "should connect two users and switch session mode" $
|
|
|
|
|
xit "should connect two users and switch session mode" $
|
|
|
|
|
withSmpServer t testTwoUsers
|
|
|
|
|
describe "Connection switch" $ do
|
|
|
|
|
describe "should switch delivery to the new queue" $
|
|
|
|
|
xdescribe "should switch delivery to the new queue" $
|
|
|
|
|
testServerMatrix2 t testSwitchConnection
|
|
|
|
|
describe "should switch to new queue asynchronously" $
|
|
|
|
|
xdescribe "should switch to new queue asynchronously" $
|
|
|
|
|
testServerMatrix2 t testSwitchAsync
|
|
|
|
|
describe "should delete connection during switch" $
|
|
|
|
|
testServerMatrix2 t testSwitchDelete
|
|
|
|
|
describe "should abort switch in Started phase" $
|
|
|
|
|
xdescribe "should abort switch in Started phase" $
|
|
|
|
|
testServerMatrix2 t testAbortSwitchStarted
|
|
|
|
|
describe "should abort switch in Started phase, reinitiate immediately" $
|
|
|
|
|
xdescribe "should abort switch in Started phase, reinitiate immediately" $
|
|
|
|
|
testServerMatrix2 t testAbortSwitchStartedReinitiate
|
|
|
|
|
describe "should prohibit to abort switch in Secured phase" $
|
|
|
|
|
xdescribe "should prohibit to abort switch in Secured phase" $
|
|
|
|
|
testServerMatrix2 t testCannotAbortSwitchSecured
|
|
|
|
|
describe "should switch two connections simultaneously" $
|
|
|
|
|
xdescribe "should switch two connections simultaneously" $
|
|
|
|
|
testServerMatrix2 t testSwitch2Connections
|
|
|
|
|
describe "should switch two connections simultaneously, abort one" $
|
|
|
|
|
xdescribe "should switch two connections simultaneously, abort one" $
|
|
|
|
|
testServerMatrix2 t testSwitch2ConnectionsAbort1
|
|
|
|
|
describe "SMP basic auth" $ do
|
|
|
|
|
let v4 = prevVersion basicAuthSMPVersion
|
|
|
|
|
forM_ (nub [prevVersion authCmdsSMPVersion, authCmdsSMPVersion, currentServerSMPRelayVersion]) $ \v -> do
|
|
|
|
|
forM_ (nub [prevVersion authCmdsSMPVersion, authCmdsSMPVersion, prevVersion currentServerSMPRelayVersion]) $ \v -> do
|
|
|
|
|
let baseId = if v >= sndAuthKeySMPVersion then 1 else 3
|
|
|
|
|
describe ("v" <> show v <> ": with server auth") $ do
|
|
|
|
|
-- allow NEW | server auth, v | clnt1 auth, v | clnt2 auth, v | 2 - success, 1 - JOIN fail, 0 - NEW fail
|
|
|
|
@@ -444,15 +444,15 @@ functionalAPITests t = do
|
|
|
|
|
it "should return the same data for both peers" $
|
|
|
|
|
withSmpServer t testRatchetAdHash
|
|
|
|
|
describe "Delivery receipts" $ do
|
|
|
|
|
it "should send and receive delivery receipt" $ withSmpServer t testDeliveryReceipts
|
|
|
|
|
it "should send delivery receipt only in connection v3+" $ testDeliveryReceiptsVersion t
|
|
|
|
|
xit "should send and receive delivery receipt" $ withSmpServer t testDeliveryReceipts
|
|
|
|
|
xit "should send delivery receipt only in connection v3+" $ testDeliveryReceiptsVersion t
|
|
|
|
|
it "send delivery receipts concurrently with messages" $ testDeliveryReceiptsConcurrent t
|
|
|
|
|
describe "user network info" $ do
|
|
|
|
|
it "should wait for user network" testWaitForUserNetwork
|
|
|
|
|
it "should not reset online to offline if happens too quickly" testDoNotResetOnlineToOffline
|
|
|
|
|
it "should resume multiple threads" testResumeMultipleThreads
|
|
|
|
|
describe "SMP queue info" $ do
|
|
|
|
|
it "server should respond with queue and subscription information" $
|
|
|
|
|
xit "server should respond with queue and subscription information" $
|
|
|
|
|
withSmpServer t testServerQueueInfo
|
|
|
|
|
|
|
|
|
|
testBasicAuth :: ATransport -> Bool -> (Maybe BasicAuth, VersionSMP) -> (Maybe BasicAuth, VersionSMP) -> (Maybe BasicAuth, VersionSMP) -> AgentMsgId -> IO Int
|
|
|
|
@@ -475,28 +475,28 @@ canCreateQueue allowNew (srvAuth, srvVersion) (clntAuth, clntVersion) =
|
|
|
|
|
|
|
|
|
|
testMatrix2 :: HasCallStack => ATransport -> (PQSupport -> Bool -> AgentClient -> AgentClient -> AgentMsgId -> IO ()) -> Spec
|
|
|
|
|
testMatrix2 t runTest = do
|
|
|
|
|
it "current, via proxy" $ withSmpServerProxy t $ runTestCfgServers2 agentCfg agentCfg (initAgentServersProxy SPMAlways SPFProhibit) 1 $ runTest PQSupportOn True
|
|
|
|
|
xit "current, via proxy" $ withSmpServerProxy t $ runTestCfgServers2 agentCfg agentCfg (initAgentServersProxy SPMAlways SPFProhibit) 1 $ runTest PQSupportOn True
|
|
|
|
|
it "v8, via proxy" $ withSmpServerProxy t $ runTestCfgServers2 agentProxyCfgV8 agentProxyCfgV8 (initAgentServersProxy SPMAlways SPFProhibit) 3 $ runTest PQSupportOn True
|
|
|
|
|
it "current" $ withSmpServer t $ runTestCfg2 agentCfg agentCfg 1 $ runTest PQSupportOn False
|
|
|
|
|
xit "current" $ withSmpServer t $ runTestCfg2 agentCfg agentCfg 1 $ runTest PQSupportOn False
|
|
|
|
|
it "prev" $ withSmpServer t $ runTestCfg2 agentCfgVPrev agentCfgVPrev 3 $ runTest PQSupportOff False
|
|
|
|
|
it "prev to current" $ withSmpServer t $ runTestCfg2 agentCfgVPrev agentCfg 3 $ runTest PQSupportOff False
|
|
|
|
|
it "current to prev" $ withSmpServer t $ runTestCfg2 agentCfg agentCfgVPrev 3 $ runTest PQSupportOff False
|
|
|
|
|
|
|
|
|
|
testBasicMatrix2 :: HasCallStack => ATransport -> (AgentClient -> AgentClient -> AgentMsgId -> IO ()) -> Spec
|
|
|
|
|
testBasicMatrix2 t runTest = do
|
|
|
|
|
it "current" $ withSmpServer t $ runTestCfg2 agentCfg agentCfg 1 $ runTest
|
|
|
|
|
xit "current" $ withSmpServer t $ runTestCfg2 agentCfg agentCfg 1 $ runTest
|
|
|
|
|
it "prev" $ withSmpServer t $ runTestCfg2 agentCfgVPrevPQ agentCfgVPrevPQ 3 $ runTest
|
|
|
|
|
it "prev to current" $ withSmpServer t $ runTestCfg2 agentCfgVPrevPQ agentCfg 3 $ runTest
|
|
|
|
|
it "current to prev" $ withSmpServer t $ runTestCfg2 agentCfg agentCfgVPrevPQ 3 $ runTest
|
|
|
|
|
|
|
|
|
|
testRatchetMatrix2 :: HasCallStack => ATransport -> (PQSupport -> Bool -> AgentClient -> AgentClient -> AgentMsgId -> IO ()) -> Spec
|
|
|
|
|
testRatchetMatrix2 t runTest = do
|
|
|
|
|
it "current, via proxy" $ withSmpServerProxy t $ runTestCfgServers2 agentCfg agentCfg (initAgentServersProxy SPMAlways SPFProhibit) 1 $ runTest PQSupportOn True
|
|
|
|
|
xit "current, via proxy" $ withSmpServerProxy t $ runTestCfgServers2 agentCfg agentCfg (initAgentServersProxy SPMAlways SPFProhibit) 1 $ runTest PQSupportOn True
|
|
|
|
|
it "v8, via proxy" $ withSmpServerProxy t $ runTestCfgServers2 agentProxyCfgV8 agentProxyCfgV8 (initAgentServersProxy SPMAlways SPFProhibit) 3 $ runTest PQSupportOn True
|
|
|
|
|
it "ratchet current" $ withSmpServer t $ runTestCfg2 agentCfg agentCfg 1 $ runTest PQSupportOn False
|
|
|
|
|
it "ratchet prev" $ withSmpServer t $ runTestCfg2 agentCfgRatchetVPrev agentCfgRatchetVPrev 1 $ runTest PQSupportOff False
|
|
|
|
|
it "ratchets prev to current" $ withSmpServer t $ runTestCfg2 agentCfgRatchetVPrev agentCfg 1 $ runTest PQSupportOff False
|
|
|
|
|
it "ratchets current to prev" $ withSmpServer t $ runTestCfg2 agentCfg agentCfgRatchetVPrev 1 $ runTest PQSupportOff False
|
|
|
|
|
xit "ratchet current" $ withSmpServer t $ runTestCfg2 agentCfg agentCfg 1 $ runTest PQSupportOn False
|
|
|
|
|
xit "ratchet prev" $ withSmpServer t $ runTestCfg2 agentCfgRatchetVPrev agentCfgRatchetVPrev 1 $ runTest PQSupportOff False
|
|
|
|
|
xit "ratchets prev to current" $ withSmpServer t $ runTestCfg2 agentCfgRatchetVPrev agentCfg 1 $ runTest PQSupportOff False
|
|
|
|
|
xit "ratchets current to prev" $ withSmpServer t $ runTestCfg2 agentCfg agentCfgRatchetVPrev 1 $ runTest PQSupportOff False
|
|
|
|
|
|
|
|
|
|
testServerMatrix2 :: HasCallStack => ATransport -> (InitialAgentServers -> IO ()) -> Spec
|
|
|
|
|
testServerMatrix2 t runTest = do
|
|
|
|
@@ -1947,7 +1947,7 @@ testWaitDeliveryNoPending t = withAgentClients2 $ \alice bob ->
|
|
|
|
|
liftIO $ noMessages alice "nothing else should be delivered to alice"
|
|
|
|
|
liftIO $ noMessages bob "nothing else should be delivered to bob"
|
|
|
|
|
where
|
|
|
|
|
baseId = 1
|
|
|
|
|
baseId = 3
|
|
|
|
|
msgId = subtract baseId
|
|
|
|
|
|
|
|
|
|
testWaitDelivery :: ATransport -> IO ()
|
|
|
|
@@ -2001,7 +2001,7 @@ testWaitDelivery t =
|
|
|
|
|
liftIO $ noMessages alice "nothing else should be delivered to alice"
|
|
|
|
|
liftIO $ noMessages bob "nothing else should be delivered to bob"
|
|
|
|
|
where
|
|
|
|
|
baseId = 1
|
|
|
|
|
baseId = 3
|
|
|
|
|
msgId = subtract baseId
|
|
|
|
|
|
|
|
|
|
testWaitDeliveryAUTHErr :: ATransport -> IO ()
|
|
|
|
@@ -2044,7 +2044,7 @@ testWaitDeliveryAUTHErr t =
|
|
|
|
|
liftIO $ noMessages alice "nothing else should be delivered to alice"
|
|
|
|
|
liftIO $ noMessages bob "nothing else should be delivered to bob"
|
|
|
|
|
where
|
|
|
|
|
baseId = 1
|
|
|
|
|
baseId = 3
|
|
|
|
|
msgId = subtract baseId
|
|
|
|
|
|
|
|
|
|
testWaitDeliveryTimeout :: ATransport -> IO ()
|
|
|
|
@@ -2084,7 +2084,7 @@ testWaitDeliveryTimeout t =
|
|
|
|
|
liftIO $ noMessages alice "nothing else should be delivered to alice"
|
|
|
|
|
liftIO $ noMessages bob "nothing else should be delivered to bob"
|
|
|
|
|
where
|
|
|
|
|
baseId = 1
|
|
|
|
|
baseId = 3
|
|
|
|
|
msgId = subtract baseId
|
|
|
|
|
|
|
|
|
|
testWaitDeliveryTimeout2 :: ATransport -> IO ()
|
|
|
|
@@ -2130,7 +2130,7 @@ testWaitDeliveryTimeout2 t =
|
|
|
|
|
liftIO $ noMessages alice "nothing else should be delivered to alice"
|
|
|
|
|
liftIO $ noMessages bob "nothing else should be delivered to bob"
|
|
|
|
|
where
|
|
|
|
|
baseId = 1
|
|
|
|
|
baseId = 3
|
|
|
|
|
msgId = subtract baseId
|
|
|
|
|
|
|
|
|
|
testJoinConnectionAsyncReplyErrorV8 :: HasCallStack => ATransport -> IO ()
|
|
|
|
@@ -3087,7 +3087,7 @@ exchangeGreetings :: HasCallStack => AgentClient -> ConnId -> AgentClient -> Con
|
|
|
|
|
exchangeGreetings = exchangeGreetings_ PQEncOn
|
|
|
|
|
|
|
|
|
|
exchangeGreetings_ :: HasCallStack => PQEncryption -> AgentClient -> ConnId -> AgentClient -> ConnId -> ExceptT AgentErrorType IO ()
|
|
|
|
|
exchangeGreetings_ pqEnc = exchangeGreetingsMsgId_ pqEnc 2
|
|
|
|
|
exchangeGreetings_ pqEnc = exchangeGreetingsMsgId_ pqEnc 4
|
|
|
|
|
|
|
|
|
|
exchangeGreetingsMsgId :: HasCallStack => Int64 -> AgentClient -> ConnId -> AgentClient -> ConnId -> ExceptT AgentErrorType IO ()
|
|
|
|
|
exchangeGreetingsMsgId = exchangeGreetingsMsgId_ PQEncOn
|
|
|
|
|