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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
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
a23a0113
Commit
a23a0113
authored
Oct 02, 2024
by
Alexandre Delanoë
1
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/adinapoli/issue-408' into dev
parents
b6e13788
c2531060
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
Jobs.hs
test/Test/Utils/Jobs.hs
+14
-5
No files found.
test/Test/Utils/Jobs.hs
View file @
a23a0113
...
...
@@ -363,23 +363,30 @@ testMarkProgress = do
myEnv
<-
newTestEnv
-- evts <- newTBQueueIO 7
evts
<-
newTVarIO
[]
let
expectedEvents
=
7
let
getStatus
hdl
=
do
liftIO
$
threadDelay
100
_000
st
<-
getLatestJobStatus
hdl
-- liftIO $ atomically $ writeTBQueue evts st
liftIO
$
atomically
$
modifyTVar
evts
(
\
xs
->
xs
++
[
st
])
readAllEvents
=
do
readAllEvents
=
do
-- We will get thread blocking if there is ANY error in the job
-- Hence we assert the `readAllEvents` test doesn't take too long
mRet
<-
timeout
1
_000_000
$
atomically
$
do
mRet
<-
timeout
5
_000_000
$
atomically
$
do
-- allEventsArrived <- isFullTBQueue evts
evts'
<-
readTVar
evts
-- STM retry if things failed
-- check allEventsArrived
check
(
length
evts'
==
7
)
check
(
length
evts'
==
expectedEvents
)
-- flushTBQueue evts
return
evts'
return
$
fromMaybe
[]
mRet
pure
evts'
case
mRet
of
Nothing
->
Prelude
.
fail
$
"testMarkProgress: timeout exceeded, but didn't receive all 7 required events."
Just
xs
|
length
xs
==
expectedEvents
->
pure
xs
|
otherwise
->
Prelude
.
fail
$
"testMarkProgress: received some events, but they were not of the expected number ("
<>
show
expectedEvents
<>
"): "
<>
show
xs
withJob_
myEnv
$
\
hdl
_input
->
do
markStarted
10
hdl
...
...
@@ -406,6 +413,8 @@ testMarkProgress = do
getStatus
hdl
evts'
<-
readAllEvents
-- This pattern match should never fail, because the precondition is
-- checked in 'readAllEvents'.
let
[
jl0
,
jl1
,
jl2
,
jl3
,
jl4
,
jl5
,
jl6
]
=
evts'
-- Check the events are what we expect
...
...
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