From 34e8b9dbe7d95ae765249e083dca304dc2d49ccc Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:21:52 +0000 Subject: [PATCH] debug test --- tests/AgentTests/NotificationTests.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/AgentTests/NotificationTests.hs b/tests/AgentTests/NotificationTests.hs index 15f505a92..581aac5d5 100644 --- a/tests/AgentTests/NotificationTests.hs +++ b/tests/AgentTests/NotificationTests.hs @@ -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