Commit 68dbf45c authored by Alfredo Di Napoli's avatar Alfredo Di Napoli Committed by Alfredo Di Napoli

Restore timeout value for ping pong test

The bug is elsewhere.
parent 45037f2d
...@@ -211,7 +211,9 @@ checkNotification ctx@(SpecContext testEnv port _app _) act = do ...@@ -211,7 +211,9 @@ checkNotification ctx@(SpecContext testEnv port _app _) act = do
act authRes act authRes
waitForTChanValue tchan (Just $ DT.NUpdateTree treeId) 1_000 -- Wait /up to/ 5 seconds for the notification value. This makes running the tests
-- a bit less flaky on CI, which might be slower to process the incoming notifications.
waitForTChanValue tchan (Just $ DT.NUpdateTree treeId) 5_000
where where
log_cfg = (test_config testEnv) ^. gc_logging log_cfg = (test_config testEnv) ^. gc_logging
......
...@@ -56,7 +56,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ do ...@@ -56,7 +56,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ do
withAsync wsConnect $ \_a -> do withAsync wsConnect $ \_a -> do
_ <- sendJobWithCfg cfg Ping _ <- sendJobWithCfg cfg Ping
mTimeout <- Timeout.timeout (60 * 1_000_000) $ do mTimeout <- Timeout.timeout (5 * 1_000_000) $ do
md <- atomically $ readTChan tchan md <- atomically $ readTChan tchan
md `shouldBe` Just DT.NPing md `shouldBe` Just DT.NPing
......
...@@ -333,15 +333,17 @@ waitUntil pred' timeoutMs = do ...@@ -333,15 +333,17 @@ waitUntil pred' timeoutMs = do
-- wait for given number of milliseconds for a given tchan value -- wait for given number of milliseconds for a given tchan value
waitForTChanValue :: (HasCallStack, Eq a, Show a) => TChan a -> a -> Int -> IO () waitForTChanValue :: (HasCallStack, Eq a, Show a) => TChan a -> a -> Int -> IO ()
waitForTChanValue tchan expected timeoutMs = do waitForTChanValue tchan expected timeoutMs = do
mTimeout <- Timeout.timeout (timeoutMs * 1000) $ do mTimeout <- Timeout.timeout total_wait $ do
v <- atomically $ readTChan tchan v <- atomically $ readTChan tchan
unless (v == expected) $ panicTrace $ "[waitForTChanValue] v != expected (" <> show v <> " != " <> show expected <> ")" unless (v == expected) $ panicTrace $ "[waitForTChanValue] v != expected (" <> show v <> " != " <> show expected <> ")"
-- v `shouldBe` expected -- v `shouldBe` expected
-- no timeout should have occurred -- no timeout should have occurred
-- mTimeout `shouldSatisfy` isJust -- mTimeout `shouldSatisfy` isJust
when (isNothing mTimeout) $ when (isNothing mTimeout) $
panicTrace $ "[waitForTChanValue] timeout when waiting for " <> show expected <> " on tchan" panicTrace $ "[waitForTChanValue] timeout of " <> show total_wait <> " milliseconds exhausted when waiting for " <> show expected <> " on tchan"
where
total_wait :: Int
total_wait = timeoutMs * 1_000
waitForTSem :: HasCallStack => TSem -> Int -> IO () waitForTSem :: HasCallStack => TSem -> Int -> IO ()
waitForTSem tsem timeoutMs = do waitForTSem tsem timeoutMs = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment