debug test

This commit is contained in:
Evgeny Poberezkin
2024-01-08 16:21:52 +00:00
parent e1518f06e2
commit 34e8b9dbe7

View File

@@ -88,7 +88,7 @@ notificationTests t =
withAPNSMockServer $ \apns ->
withNtfServer t $ testNotificationsSMPRestart t apns
describe "Notifications after SMP server restart" $
it "should resume batched subscriptions after SMP server is restarted" $ \_ ->
fit "should resume batched subscriptions after SMP server is restarted" $ \_ ->
withAPNSMockServer $ \apns ->
withNtfServer t $ testNotificationsSMPRestartBatch 100 t apns
describe "should switch notifications to the new queue" $
@@ -504,15 +504,20 @@ testNotificationsSMPRestartBatch n t APNSMockServer {apnsQ} = do
a <- getSMPAgentClient' agentCfg initAgentServers2 testDB
b <- getSMPAgentClient' agentCfg initAgentServers2 testDB2
conns <- runServers $ do
liftIO $ print 1
conns <- replicateM (n :: Int) $ makeConnection a b
liftIO $ print 2
_ <- registerTestToken a "abcd" NMInstant apnsQ
liftIO $ print 3
liftIO $ threadDelay 1500000
liftIO $ print 4
forM_ conns $ \(aliceId, bobId) -> do
msgId <- sendMessage b aliceId (SMP.MsgFlags True) "hello"
get b ##> ("", aliceId, SENT msgId)
void $ messageNotification apnsQ
get a =##> \case ("", c, Msg "hello") -> c == bobId; _ -> False
ackMessage a bobId msgId Nothing
liftIO $ print 5
pure conns
runRight_ @AgentErrorType $ do
@@ -523,6 +528,8 @@ testNotificationsSMPRestartBatch n t APNSMockServer {apnsQ} = do
("", "", DOWN _ acs2) <- nGet b
liftIO $ length (acs1 <> acs2) `shouldBe` length conns
print 6
runServers $ do
("", "", UP _ bcs1) <- nGet a
("", "", UP _ bcs2) <- nGet a
@@ -531,11 +538,13 @@ testNotificationsSMPRestartBatch n t APNSMockServer {apnsQ} = do
("", "", UP _ acs2) <- nGet b
liftIO $ length (acs1 <> acs2) `shouldBe` length conns
liftIO $ threadDelay 1500000
liftIO $ print 6
forM_ conns $ \(aliceId, bobId) -> do
msgId <- sendMessage b aliceId (SMP.MsgFlags True) "hello again"
get b ##> ("", aliceId, SENT msgId)
_ <- messageNotificationData a apnsQ
get a =##> \case ("", c, Msg "hello again") -> c == bobId; _ -> False
liftIO $ print 7
disconnectAgentClient a
disconnectAgentClient b
where