Skip to content

Commit

Permalink
fix more nGet/UP
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwiz committed May 30, 2024
1 parent c76d167 commit dcbda5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions tests/AgentTests/FunctionalAPITests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module AgentTests.FunctionalAPITests
rfGet,
sfGet,
nGet,
nGetUP,
(##>),
(=##>),
pattern CON,
Expand Down
13 changes: 7 additions & 6 deletions tests/AgentTests/NotificationTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import AgentTests.FunctionalAPITests
joinConnection,
makeConnection,
nGet,
nGetUP,
runRight,
runRight_,
sendMessage,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/SMPProxyTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcbda5a

Please sign in to comment.