[tests] fixes to tests blocking

parent 69d97371
Pipeline #6599 canceled with stages
in 95 minutes and 13 seconds
...@@ -18,7 +18,7 @@ fi ...@@ -18,7 +18,7 @@ fi
# with the `sha256sum` result calculated on the `cabal.project` and # with the `sha256sum` result calculated on the `cabal.project` and
# `cabal.project.freeze`. This ensures the files stay deterministic so that CI # `cabal.project.freeze`. This ensures the files stay deterministic so that CI
# cache can kick in. # cache can kick in.
expected_cabal_project_hash="621f0f55cfded5f0a8218e254020f09ace0bf38fc93b6ed27a500cf48592dd4f" expected_cabal_project_hash="ebcccf8bd6ad8ea5adad45f63c7c1eb2026439fe19bd06840d5d962e8ce05c38"
expected_cabal_project_freeze_hash="cd6fd302c204416ec84428dacab6d0e311a42ebd4b8db6227dcc57ccc8a6705a" expected_cabal_project_freeze_hash="cd6fd302c204416ec84428dacab6d0e311a42ebd4b8db6227dcc57ccc8a6705a"
......
...@@ -168,8 +168,8 @@ source-repository-package ...@@ -168,8 +168,8 @@ source-repository-package
-- FIXME(adn) Compat-shim while we wait for upstream to catch-up -- FIXME(adn) Compat-shim while we wait for upstream to catch-up
source-repository-package source-repository-package
type: git type: git
location: https://github.com/adinapoli/nanomsg-haskell location: https://github.com/garganscript/nanomsg-haskell
tag: f54fe61f06685c5af95ddff782e139d8d4e26186 tag: 5868db564d7d3c4568ccd11c852292b834d26c55
-- source-repository-package -- source-repository-package
-- type: git -- type: git
......
...@@ -866,7 +866,7 @@ common testDependencies ...@@ -866,7 +866,7 @@ common testDependencies
, split , split
, stm ^>= 2.5.0.1 , stm ^>= 2.5.0.1
, streaming-commons , streaming-commons
, tasty ^>= 1.4.2.1 , tasty >= 1.5 && < 1.6
, tasty-golden , tasty-golden
, tasty-hspec , tasty-hspec
, tasty-hunit , tasty-hunit
...@@ -890,7 +890,7 @@ common testDependencies ...@@ -890,7 +890,7 @@ common testDependencies
, shelly >= 1.9 && < 2 , shelly >= 1.9 && < 2
, stm ^>= 2.5.0.1 , stm ^>= 2.5.0.1
, streaming-commons , streaming-commons
, tasty ^>= 1.4.2.1 , tasty >= 1.5 && < 1.6
, tasty-hspec , tasty-hspec
, tasty-hunit , tasty-hunit
, tasty-quickcheck , tasty-quickcheck
...@@ -985,6 +985,7 @@ test-suite garg-test-hspec ...@@ -985,6 +985,7 @@ test-suite garg-test-hspec
Test.Database.Operations.NodeStory Test.Database.Operations.NodeStory
Test.Database.Setup Test.Database.Setup
Test.Database.Types Test.Database.Types
Test.Instances
Test.Server.ReverseProxy Test.Server.ReverseProxy
Test.Types Test.Types
Test.Utils Test.Utils
......
...@@ -29,7 +29,7 @@ import Gargantext.Core.AsyncUpdates.CentralExchange.Types ...@@ -29,7 +29,7 @@ import Gargantext.Core.AsyncUpdates.CentralExchange.Types
import Gargantext.Core.Config.Types (NotificationsConfig(..)) import Gargantext.Core.Config.Types (NotificationsConfig(..))
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.System.Logging (LogLevel(..), withLogger, logMsg) import Gargantext.System.Logging (LogLevel(..), withLogger, logMsg)
import Nanomsg (Pull(..), Push(..), bind, connect, recv, send, withSocket) import Nanomsg (Pull(..), Push(..), bind, connect, recv, sendNonblocking, withSocket)
{- {-
...@@ -74,7 +74,7 @@ gServer (NotificationsConfig { .. }) = do ...@@ -74,7 +74,7 @@ gServer (NotificationsConfig { .. }) = do
Just _ujp@(UpdateJobProgress _s) -> do Just _ujp@(UpdateJobProgress _s) -> do
-- logMsg ioLogger DEBUG $ "[central_exchange] " <> show ujp -- logMsg ioLogger DEBUG $ "[central_exchange] " <> show ujp
-- send the same message that we received -- send the same message that we received
send s_dispatcher r void $ sendNonblocking s_dispatcher r
Just (UpdateTreeFirstLevel node_id) -> do Just (UpdateTreeFirstLevel node_id) -> do
logMsg ioLogger INFO $ "[central_exchange] update tree: " <> show node_id logMsg ioLogger INFO $ "[central_exchange] update tree: " <> show node_id
-- putText $ "[central_exchange] sending that to the dispatcher: " <> show node_id -- putText $ "[central_exchange] sending that to the dispatcher: " <> show node_id
...@@ -92,7 +92,7 @@ gServer (NotificationsConfig { .. }) = do ...@@ -92,7 +92,7 @@ gServer (NotificationsConfig { .. }) = do
-- gargantext-server but maybe it can be a separate -- gargantext-server but maybe it can be a separate
-- process, independent of the server. -- process, independent of the server.
-- send the same message that we received -- send the same message that we received
send s_dispatcher r void $ sendNonblocking s_dispatcher r
_ -> logMsg ioLogger DEBUG $ "[central_exchange] unknown message" _ -> logMsg ioLogger DEBUG $ "[central_exchange] unknown message"
...@@ -104,4 +104,4 @@ notify (NotificationsConfig { _nc_central_exchange_connect }) ceMessage = do ...@@ -104,4 +104,4 @@ notify (NotificationsConfig { _nc_central_exchange_connect }) ceMessage = do
let str = Aeson.encode ceMessage let str = Aeson.encode ceMessage
withLogger () $ \ioLogger -> withLogger () $ \ioLogger ->
logMsg ioLogger INFO $ "[central_exchange] sending: " <> (T.unpack $ TE.decodeUtf8 $ BSL.toStrict str) logMsg ioLogger INFO $ "[central_exchange] sending: " <> (T.unpack $ TE.decodeUtf8 $ BSL.toStrict str)
send s $ BSL.toStrict str void $ sendNonblocking s $ BSL.toStrict str
...@@ -76,10 +76,6 @@ ...@@ -76,10 +76,6 @@
git: "https://github.com/adinapoli/llvm-hs.git" git: "https://github.com/adinapoli/llvm-hs.git"
subdirs: subdirs:
- "llvm-hs-pure" - "llvm-hs-pure"
- commit: f54fe61f06685c5af95ddff782e139d8d4e26186
git: "https://github.com/adinapoli/nanomsg-haskell"
subdirs:
- .
- commit: 74a3296dfe1f0c4a3ade91336dcc689330e84156 - commit: 74a3296dfe1f0c4a3ade91336dcc689330e84156
git: "https://github.com/adinapoli/servant-job.git" git: "https://github.com/adinapoli/servant-job.git"
subdirs: subdirs:
...@@ -116,6 +112,10 @@ ...@@ -116,6 +112,10 @@
git: "https://github.com/fpringle/servant-routes.git" git: "https://github.com/fpringle/servant-routes.git"
subdirs: subdirs:
- . - .
- commit: 5868db564d7d3c4568ccd11c852292b834d26c55
git: "https://github.com/garganscript/nanomsg-haskell"
subdirs:
- .
- commit: 4a291783f4aa83548eac5009e16e8bdcb5ddc667 - commit: 4a291783f4aa83548eac5009e16e8bdcb5ddc667
git: "https://github.com/glguy/toml-parser" git: "https://github.com/glguy/toml-parser"
subdirs: subdirs:
......
...@@ -232,5 +232,5 @@ waitUntil pred' timeoutMs = do ...@@ -232,5 +232,5 @@ waitUntil pred' timeoutMs = do
if p if p
then return () then return ()
else do else do
threadDelay 50 threadDelay 50000
performTest performTest
...@@ -22,6 +22,7 @@ import qualified Test.Database.Operations as DB ...@@ -22,6 +22,7 @@ import qualified Test.Database.Operations as DB
startCoreNLPServer :: IO ProcessHandle startCoreNLPServer :: IO ProcessHandle
startCoreNLPServer = do startCoreNLPServer = do
putText "calling start core nlp"
devNull <- openFile "/dev/null" WriteMode devNull <- openFile "/dev/null" WriteMode
let p = proc "./startServer.sh" [] let p = proc "./startServer.sh" []
(_, _, _, hdl) <- (createProcess $ p { cwd = Just "devops/coreNLP/stanford-corenlp-current" (_, _, _, hdl) <- (createProcess $ p { cwd = Just "devops/coreNLP/stanford-corenlp-current"
...@@ -39,7 +40,10 @@ startCoreNLPServer = do ...@@ -39,7 +40,10 @@ startCoreNLPServer = do
pure hdl pure hdl
stopCoreNLPServer :: ProcessHandle -> IO () stopCoreNLPServer :: ProcessHandle -> IO ()
stopCoreNLPServer = interruptProcessGroupOf stopCoreNLPServer ph = do
putText "calling stop core nlp"
interruptProcessGroupOf ph
putText "calling stop core nlp - done"
withNotifications :: ((NotificationsConfig, ThreadId, D.Dispatcher) -> IO a) -> IO a withNotifications :: ((NotificationsConfig, ThreadId, D.Dispatcher) -> IO a) -> IO a
withNotifications = bracket startNotifications stopNotifications withNotifications = bracket startNotifications stopNotifications
...@@ -51,8 +55,10 @@ withNotifications = bracket startNotifications stopNotifications ...@@ -51,8 +55,10 @@ withNotifications = bracket startNotifications stopNotifications
pure (nc, central_exchange, dispatcher) pure (nc, central_exchange, dispatcher)
stopNotifications :: (NotificationsConfig, ThreadId, D.Dispatcher) -> IO () stopNotifications :: (NotificationsConfig, ThreadId, D.Dispatcher) -> IO ()
stopNotifications (_nc, central_exchange, dispatcher) = do stopNotifications (_nc, central_exchange, dispatcher) = do
putText "calling stop notifications"
killThread central_exchange killThread central_exchange
D.terminateDispatcher dispatcher D.terminateDispatcher dispatcher
putText "calling stop notifications - done"
nc :: NotificationsConfig nc :: NotificationsConfig
nc = NotificationsConfig { _nc_central_exchange_bind = "tcp://*:15560" nc = NotificationsConfig { _nc_central_exchange_bind = "tcp://*:15560"
...@@ -76,9 +82,11 @@ main = do ...@@ -76,9 +82,11 @@ main = do
hSetBuffering stdout NoBuffering hSetBuffering stdout NoBuffering
-- TODO Ideally remove start/stop notifications and use -- TODO Ideally remove start/stop notifications and use
-- Test/API/Setup to initialize this in env -- Test/API/Setup to initialize this in env
withNotifications $ \(nc', _, _) -> do withNotifications $ \(nc, _, _) -> do
bracket startCoreNLPServer stopCoreNLPServer $ \_ -> hspec $ do bracket startCoreNLPServer stopCoreNLPServer $ \_ -> hspec $ do
API.tests nc' API.tests nc
ReverseProxy.tests ReverseProxy.tests
DB.tests DB.tests
DB.nodeStoryTests DB.nodeStoryTests
runIO $ putText "tests finished"
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