[tests] fixes to tests blocking

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