From dcbda5ab693e969e0d476bed80640b7c3f8294d0 Mon Sep 17 00:00:00 2001 From: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com> Date: Thu, 30 May 2024 17:30:44 +0300 Subject: [PATCH] fix more nGet/UP --- tests/AgentTests/FunctionalAPITests.hs | 1 + tests/AgentTests/NotificationTests.hs | 13 +++++++------ tests/SMPProxyTests.hs | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/AgentTests/FunctionalAPITests.hs b/tests/AgentTests/FunctionalAPITests.hs index 9cd0664c0..6704a0fd8 100644 --- a/tests/AgentTests/FunctionalAPITests.hs +++ b/tests/AgentTests/FunctionalAPITests.hs @@ -39,6 +39,7 @@ module AgentTests.FunctionalAPITests rfGet, sfGet, nGet, + nGetUP, (##>), (=##>), pattern CON, diff --git a/tests/AgentTests/NotificationTests.hs b/tests/AgentTests/NotificationTests.hs index a7c3fb25a..b2e9fee52 100644 --- a/tests/AgentTests/NotificationTests.hs +++ b/tests/AgentTests/NotificationTests.hs @@ -19,6 +19,7 @@ import AgentTests.FunctionalAPITests joinConnection, makeConnection, nGet, + nGetUP, runRight, runRight_, sendMessage, @@ -594,8 +595,8 @@ testNotificationsSMPRestart t APNSMockServer {apnsQ} = withAgentClients2 $ \alic nGet bob =##> \case ("", "", DOWN _ [c]) -> c == aliceId; _ -> False withSmpServerStoreLogOn t testPort $ \threadId -> runRight_ $ do - nGet alice =##> \case ("", "", UP _ [c]) -> c == bobId; _ -> False - nGet bob =##> \case ("", "", UP _ [c]) -> c == aliceId; _ -> False + nGetUP alice =##> \case ("", "", UP _ [c]) -> c == bobId; _ -> False + nGetUP bob =##> \case ("", "", UP _ [c]) -> c == aliceId; _ -> False liftIO $ threadDelay 1000000 5 <- sendMessage bob aliceId (SMP.MsgFlags True) "hello again" get bob ##> ("", aliceId, SENT 5) @@ -628,11 +629,11 @@ testNotificationsSMPRestartBatch n t APNSMockServer {apnsQ} = liftIO $ length (acs1 <> acs2) `shouldBe` length conns runServers $ do - ("", "", UP _ bcs1) <- nGet a - ("", "", UP _ bcs2) <- nGet a + ("", "", UP _ bcs1) <- nGetUP a + ("", "", UP _ bcs2) <- nGetUP a liftIO $ length (bcs1 <> bcs2) `shouldBe` length conns - ("", "", UP _ acs1) <- nGet b - ("", "", UP _ acs2) <- nGet b + ("", "", UP _ acs1) <- nGetUP b + ("", "", UP _ acs2) <- nGetUP b liftIO $ length (acs1 <> acs2) `shouldBe` length conns liftIO $ threadDelay 1500000 forM_ conns $ \(aliceId, bobId) -> do diff --git a/tests/SMPProxyTests.hs b/tests/SMPProxyTests.hs index 036c8b203..ea09e4045 100644 --- a/tests/SMPProxyTests.hs +++ b/tests/SMPProxyTests.hs @@ -348,7 +348,7 @@ agentViaProxyRetryOffline = do withServer2 = withServer_ testStoreLogFile2 testStoreMsgsFile2 testPort2 withServer_ storeLog storeMsgs port = withSmpServerConfigOn (transport @TLS) proxyCfg {storeLogFile = Just storeLog, storeMsgsFile = Just storeMsgs} port - a `up` cId = nGet a =##> \case ("", "", UP _ [c]) -> c == cId; _ -> False + a `up` cId = nGetUP a =##> \case ("", "", UP _ [c]) -> c == cId; _ -> False a `down` cId = nGet a =##> \case ("", "", DOWN _ [c]) -> c == cId; _ -> False aCfg = agentProxyCfg {messageRetryInterval = fastMessageRetryInterval} baseId = 3