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
197
Issues
197
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
Hide 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
...
@@ -25,7 +25,6 @@ import Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Prelude
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node
(
getOrMkList
)
import
Gargantext.Database.Query.Table.Node
(
getOrMkList
)
import
Gargantext.Database.Query.Tree.Root
(
MkCorpusUser
(
..
))
import
Gargantext.Database.Query.Tree.Root
(
MkCorpusUser
(
..
))
import
Gargantext.Prelude
(
forkIO
)
import
Gargantext.Prelude.Config
import
Gargantext.Prelude.Config
import
Gargantext.Prelude.Mail
qualified
as
Mail
import
Gargantext.Prelude.Mail
qualified
as
Mail
import
Gargantext.Prelude.NLP
qualified
as
NLP
import
Gargantext.Prelude.NLP
qualified
as
NLP
...
@@ -69,8 +68,8 @@ newTestEnv testEnv logger port = do
...
@@ -69,8 +68,8 @@ newTestEnv testEnv logger port = do
!
config_mail
<-
Mail
.
readConfig
file
!
config_mail
<-
Mail
.
readConfig
file
!
nlp_env
<-
nlpServerMap
<$>
NLP
.
readConfig
file
!
nlp_env
<-
nlpServerMap
<$>
NLP
.
readConfig
file
!
central_exchange
<-
forkIO
CE
.
gServer
--
!central_exchange <- forkIO CE.gServer
!
dispatcher
<-
D
.
dispatcher
--
!dispatcher <- D.dispatcher
pure
$
Env
pure
$
Env
{
_env_settings
=
settings'
{
_env_settings
=
settings'
...
@@ -84,8 +83,10 @@ newTestEnv testEnv logger port = do
...
@@ -84,8 +83,10 @@ newTestEnv testEnv logger port = do
,
_env_config
=
config_env
,
_env_config
=
config_env
,
_env_mail
=
config_mail
,
_env_mail
=
config_mail
,
_env_nlp
=
nlp_env
,
_env_nlp
=
nlp_env
,
_env_central_exchange
=
central_exchange
,
_env_central_exchange
=
Prelude
.
error
"central exchange not needed, but forced somewhere (check StrictData)"
,
_env_dispatcher
=
dispatcher
,
_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
()
withGargApp
::
Application
->
(
Warp
.
Port
->
IO
()
)
->
IO
()
...
...
test/drivers/hspec/Main.hs
View file @
6f767241
...
@@ -4,8 +4,12 @@ module Main where
...
@@ -4,8 +4,12 @@ module Main where
import
Gargantext.Prelude
hiding
(
isInfixOf
)
import
Gargantext.Prelude
hiding
(
isInfixOf
)
import
Control.Concurrent
(
forkIO
,
killThread
)
import
Control.Monad
import
Control.Monad
import
Data.Text
(
isInfixOf
)
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
Shelly
hiding
(
FilePath
)
import
System.IO
import
System.IO
import
System.Process
import
System.Process
...
@@ -36,6 +40,17 @@ startCoreNLPServer = do
...
@@ -36,6 +40,17 @@ startCoreNLPServer = do
stopCoreNLPServer
::
ProcessHandle
->
IO
()
stopCoreNLPServer
::
ProcessHandle
->
IO
()
stopCoreNLPServer
=
interruptProcessGroupOf
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,
-- It's especially important to use Hspec for DB tests, because,
-- unlike 'tasty', 'Hspec' has explicit control over parallelism,
-- unlike 'tasty', 'Hspec' has explicit control over parallelism,
-- and it's important that DB tests are run according to a very
-- and it's important that DB tests are run according to a very
...
@@ -50,7 +65,8 @@ stopCoreNLPServer = interruptProcessGroupOf
...
@@ -50,7 +65,8 @@ stopCoreNLPServer = interruptProcessGroupOf
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
hSetBuffering
stdout
NoBuffering
hSetBuffering
stdout
NoBuffering
bracket
startCoreNLPServer
stopCoreNLPServer
$
\
_
->
hspec
$
do
bracket
startNotifications
stopNotifications
$
\
_
->
do
API
.
tests
bracket
startCoreNLPServer
stopCoreNLPServer
$
\
_
->
hspec
$
do
DB
.
tests
API
.
tests
DB
.
nodeStoryTests
DB
.
tests
DB
.
nodeStoryTests
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