Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
6f767241
Verified
Commit
6f767241
authored
Jun 20, 2024
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tests] some fixes to invoking dispatcher and central exchange
parent
99f21ab0
Pipeline
#6255
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
Setup.hs
test/Test/API/Setup.hs
+6
-5
Main.hs
test/drivers/hspec/Main.hs
+20
-4
No files found.
test/Test/API/Setup.hs
View file @
6f767241
...
...
@@ -25,7 +25,6 @@ import Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node
(
getOrMkList
)
import
Gargantext.Database.Query.Tree.Root
(
MkCorpusUser
(
..
))
import
Gargantext.Prelude
(
forkIO
)
import
Gargantext.Prelude.Config
import
Gargantext.Prelude.Mail
qualified
as
Mail
import
Gargantext.Prelude.NLP
qualified
as
NLP
...
...
@@ -69,8 +68,8 @@ newTestEnv testEnv logger port = do
!
config_mail
<-
Mail
.
readConfig
file
!
nlp_env
<-
nlpServerMap
<$>
NLP
.
readConfig
file
!
central_exchange
<-
forkIO
CE
.
gServer
!
dispatcher
<-
D
.
dispatcher
--
!central_exchange <- forkIO CE.gServer
--
!dispatcher <- D.dispatcher
pure
$
Env
{
_env_settings
=
settings'
...
...
@@ -84,8 +83,10 @@ newTestEnv testEnv logger port = do
,
_env_config
=
config_env
,
_env_mail
=
config_mail
,
_env_nlp
=
nlp_env
,
_env_central_exchange
=
central_exchange
,
_env_dispatcher
=
dispatcher
,
_env_central_exchange
=
Prelude
.
error
"central exchange not needed, but forced somewhere (check StrictData)"
,
_env_dispatcher
=
Prelude
.
error
"dispatcher not needed, but forced somewhere (check StrictData)"
-- , _env_central_exchange = central_exchange
-- , _env_dispatcher = dispatcher
}
withGargApp
::
Application
->
(
Warp
.
Port
->
IO
()
)
->
IO
()
...
...
test/drivers/hspec/Main.hs
View file @
6f767241
...
...
@@ -4,8 +4,12 @@ module Main where
import
Gargantext.Prelude
hiding
(
isInfixOf
)
import
Control.Concurrent
(
forkIO
,
killThread
)
import
Control.Monad
import
Data.Text
(
isInfixOf
)
import
Gargantext.Core.AsyncUpdates.CentralExchange
qualified
as
CE
import
Gargantext.Core.AsyncUpdates.Dispatcher
qualified
as
D
import
Gargantext.Core.AsyncUpdates.Dispatcher.Types
qualified
as
DT
import
Shelly
hiding
(
FilePath
)
import
System.IO
import
System.Process
...
...
@@ -36,6 +40,17 @@ startCoreNLPServer = do
stopCoreNLPServer
::
ProcessHandle
->
IO
()
stopCoreNLPServer
=
interruptProcessGroupOf
startNotifications
=
do
central_exchange
<-
forkIO
CE
.
gServer
dispatcher
<-
D
.
dispatcher
pure
(
central_exchange
,
dispatcher
)
stopNotifications
(
central_exchange
,
dispatcher
)
=
do
killThread
central_exchange
killThread
$
DT
.
d_ce_listener
dispatcher
-- It's especially important to use Hspec for DB tests, because,
-- unlike 'tasty', 'Hspec' has explicit control over parallelism,
-- and it's important that DB tests are run according to a very
...
...
@@ -50,6 +65,7 @@ stopCoreNLPServer = interruptProcessGroupOf
main
::
IO
()
main
=
do
hSetBuffering
stdout
NoBuffering
bracket
startNotifications
stopNotifications
$
\
_
->
do
bracket
startCoreNLPServer
stopCoreNLPServer
$
\
_
->
hspec
$
do
API
.
tests
DB
.
tests
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
5660aec0
·
Oct 08, 2024
mentioned in commit
5660aec0
mentioned in commit 5660aec07ec5a0a0a5468f440092c1a8f57a864e
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment